Noel
03/12/2026, 4:37 PMDevRev
03/12/2026, 4:38 PM// Android - Check session and prompt biometrics
val session = Descope.sessionManager.session
if (session != null && !session.refreshToken.isExpired) {
// Prompt for biometric authentication
showBiometricPrompt()
} else {
showLoginScreen()
}
2. Session Management
- Enable persistent sessions with long refresh token expiry (up to 1 year)
- Implement automatic token refresh
- Use native biometric prompts (LocalAuthentication/BiometricPrompt) before accessing stored tokens
3. Security Implementation
- Store refresh tokens in hardware-backed secure storage
- Implement biometric failure handling (sign out after 2 failures)
- Use Descope's session management for token validation and refresh
This approach avoids WebAuthn domain issues while providing secure, seamless authentication using native device capabilities.
Passkeys Settings Guide | Descope Documentation
Project Settings | Descope Documentation
Mobile SDK Session Management | Descope Documentation
Refresh Token Rotation | Descope DocumentationNoel
03/12/2026, 4:41 PMDevRev
03/12/2026, 4:41 PMwindow.location.origin to match your configured domain , but webviews may not provide the expected origin value. This is similar to OAuth restrictions in webviews .
Recommended Hybrid Approach
1. Native Biometric Gate
- Use native LocalAuthentication/BiometricPrompt before loading the webview
- Store refresh tokens in Keychain/Keystore as planned
- Only load the Next.js app after biometric success
2. Webview Session Management
- Pass the stored refresh token to your Next.js app via URL parameter or postMessage
- Use Descope's client SDK to establish the session in the webview context
- Configure long session timeouts (up to 1 year) to minimize re-authentication
// In Next.js webview - receive token from native app
const refreshToken = getTokenFromNativeApp();
await descope.refresh(refreshToken);
This avoids WebAuthn domain issues while maintaining your desired UX of biometric authentication on app launch, with the auth flow remaining in your familiar Next.js context.
Biometrics (Passkeys) | Backend SDK | Descope Documentation
Unsupported WebView for OAuth | Descope DocumentationNoel
03/12/2026, 4:42 PMDevRev
03/12/2026, 4:42 PMwindow.location.origin may not be available or correct
• Domain validation fails before WebAuthn can start
Solution Options
1. Add minimal delay before WebAuthn
// Allow webview to initialize before starting WebAuthn
setTimeout(() => {
startWebAuthnFlow();
}, 100);
2. Check origin availability
if (window.location.origin) {
startWebAuthnFlow();
} else {
// Fallback or retry
}
The button approach works because user interaction gives the webview sufficient time to establish the proper context for WebAuthn domain validation.