completeLogin

suspend fun completeLogin(redirectUri: String)

Completes the OAuth login flow after the browser redirects back.

  1. Validates the state parameter matches.

  2. Validates the iss parameter matches the discovered auth server.

  3. Exchanges the authorization code for tokens with PKCE + DPoP.

  4. Verifies the sub (DID) in the token response matches the resolved DID from discovery.

  5. Persists the session.

Parameters

redirectUri

The full redirect URI from the browser callback (e.g. myapp://oauth/callback?code=...&state=...&iss=...).