AuthorizeWithSolid

Signs the user in by launching the host app's consent screen from your own activity, the way a system account chooser works.

The screen shows which app is asking, lets the user pick an account, and shows what the app asks for: request, or AccessRequest.DEFAULT (the whole pod at Edit) when none is given. The user may narrow or widen it before approving, and the result carries what they approved. Ask for the least you need: an app that keeps its data in one folder asks for that folder, and only an app that shares or sends notifications asks for Full access.

Because your app launches the screen, nothing is drawn from a background service, so the host needs no overlay permission. The picker also stays live while the user hops into the host app to sign in for the first time. Check Solid.isHostInstalled before launching: with no host installed there is nothing to launch, and Android throws ActivityNotFoundException.

private val authorize = registerForActivityResult(
AuthorizeWithSolid(
AccessRequest(
level = AccessLevel.EDIT,
targets = listOf(RequestedTarget.Path("notes/")),
reason = "Notes are kept in your pod under notes/.",
),
),
) { result ->
when (result) {
is SolidSignInResult.Authorized -> onSignedIn(result.webId, result.grant)
SolidSignInResult.Dismissed -> Unit
is SolidSignInResult.Failed -> show(result.exception)
}
}

SignInButton(onClick = { authorize.launch(Unit) })

Constructors

Link copied to clipboard
constructor(request: AccessRequest? = null)

Functions

Link copied to clipboard
open override fun createIntent(context: Context, input: Unit): Intent
Link copied to clipboard
open override fun parseResult(resultCode: Int, intent: Intent?): SolidSignInResult