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. For the login flow, verifies the sub (DID) in the token response matches the resolved DID from discovery. For the signup flow, accepts sub as authoritative and hydrates handle + PDS URL from the new DID document.

  5. Persists the session.

Parameters

redirectUri

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