Native apps and biometrics
You can add biometric sign-in to a mobile app using standard OpenID Connect and OAuth, without an authN SDK.
Signing in through the system browser
Section titled “Signing in through the system browser”Mobile apps should open the project’s sign-in page in the system browser, as RFC 8252 recommends. On iOS that means ASWebAuthenticationSession, and on Android it means Custom Tabs. Libraries such as AppAuth (for iOS and Android) and expo-auth-session handle this for you.
Use the authorization code flow with PKCE, and a redirect URI that belongs to your app, such as com.example.app:/callback.
Passkeys work there with nothing extra to do, because the browser shows the device’s own Face ID or fingerprint prompt.
Binding tokens to the device with DPoP
Section titled “Binding tokens to the device with DPoP”DPoP (RFC 9449) ties an app’s tokens to a key that never leaves the phone. If you keep that key in the phone’s secure hardware and make it usable only after Face ID or a fingerprint, then every time the app opens, the person confirms with their biometric, the app signs a proof with the key, and it refreshes its tokens. A refresh token copied off the device is useless anywhere else.
When the app is first used
Section titled “When the app is first used”- Create a P-256 key in secure hardware that needs a biometric to use. On iOS, use the Secure Enclave with
.biometryCurrentSet. On Android, use the Keystore withsetUserAuthenticationRequired(true), and StrongBox where the device has it. - When you exchange the authorization code, include a
DPoPheader containing a JWT signed with that key. Its header is{"typ":"dpop+jwt","alg":"ES256","jwk":<public key>}, and its body is{"jti":<random>,"htm":"POST","htu":"<issuer>/oauth2/token","iat":<now>}. - The response says
"token_type": "DPoP". The access token contains the key’s thumbprint incnf.jkt, and for a native app the refresh token is bound to the key as well.
Each time the app opens
Section titled “Each time the app opens”Unlock the key with the person’s biometric, sign a fresh proof, and refresh. Without the key, the refresh is refused with invalid_dpop_proof, and the failed attempt doesn’t use up the refresh token.
Calling APIs
Section titled “Calling APIs”Send Authorization: DPoP <access token> together with a new proof for that request. The proof’s claims are htm, htu, and ath, which is the base64url SHA-256 hash of the access token. Your project’s userinfo endpoint and the Admin API both refuse a DPoP-bound token that’s sent as Bearer.
Options
Section titled “Options”In an application’s token settings, Require DPoP means tokens are only issued when a proof is sent.
Under Sessions and tokens, Require DPoP nonces (RFC 9449 §8) means proofs must include a nonce that authN gave out, so they can’t be prepared in advance. When a proof is missing one, the response is use_dpop_nonce with the nonce in a DPoP-Nonce header, and the app retries once with it. Standard libraries handle this for you.
You can also bind the authorization code itself to the key by adding dpop_jkt=<thumbprint> to the authorization request (RFC 9449 §10).
Proofs can be signed with ES256, EdDSA, RS256 or PS256, and are accepted for 60 seconds either side of their iat.
Checking DPoP tokens in your API
Section titled “Checking DPoP tokens in your API”Accept a token that contains cnf.jkt only if all of the following are true:
- The request uses
Authorization: DPoP. - The
DPoPheader contains a single JWT withtypset todpop+jwt, signed with an asymmetric algorithm by thejwkin its header. - That key’s RFC 7638 thumbprint is the same as
cnf.jkt. htmandhtumatch the request, ignoring the query string.iatis recent.athis the hash of the access token.- You haven’t seen the same
jtiwithin that time window.
Most API frameworks’ OAuth libraries have a DPoP option that does these checks for you.