You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> DPoP is supported only on Android version 6.0 (API level 23) and above. Trying to use DPoP in any older versions will result in an exception.
327
327
328
+
## Handling Configuration Changes During Authentication
329
+
330
+
When the Activity is destroyed during authentication due to a configuration change (e.g. device rotation, locale change, dark mode toggle), the SDK caches the authentication result internally. Call `WebAuthProvider.registerCallbacks()` once in your `onCreate()` to recover it. This single call handles both recovery scenarios:
331
+
332
+
-**Configuration change**: delivers any cached result on the next `onResume` to the callback
333
+
-**Process death**: `AuthenticationActivity` restores OAuth state and processes the redirect. Since static state was wiped, the result is cached and delivered to `loginCallback` on the next `onResume` after `registerCallbacks()` is called
> If you use the `suspend fun await()` API from a ViewModel coroutine scope, the Activity is never captured in the callback chain, so you do not need `registerCallbacks()` calls.
377
+
328
378
## Authentication API
329
379
330
380
The client provides methods to authenticate the user against the Auth0 server.
`registerCallbacks()` covers both scenarios in one call:
363
+
364
+
| Scenario | How it's handled |
365
+
|----------|-----------------|
366
+
|**Configuration change** (rotation, locale, dark mode) | The result is delivered directly to the registered callback once the async token exchange completes. If no callback is registered yet, the result is cached and delivered on the next `onResume`|
367
+
|**Process death** (system killed the app while browser was open) |`AuthenticationActivity` restores the OAuth state and processes the redirect. Since all static state (including `callbacks`) was wiped, the result is cached in `pendingLoginResult`. When your Activity is recreated and calls `registerCallbacks()`, the cached result is delivered on the next `onResume`|
368
+
369
+
> **Note:** Both `loginCallback` and `logoutCallback` are required — this ensures results from either flow are never lost during configuration changes or process death.
370
+
371
+
> **Note:** If you use the `suspend fun await()` API from a ViewModel coroutine scope, the
372
+
> Activity is never captured in the callback chain, so you do not need `registerCallbacks()` calls.
373
+
> See the sample app for a ViewModel-based example.
0 commit comments