Skip to main content
Didit’s me.didit:didit-auth library signs your Android app’s end users up and in with Didit Authentication. It opens your application’s hosted Didit page in a Custom Tab, supports passkeys through Credential Manager, keeps the session encrypted with the Android Keystore, and handles sign-out and step-up. It ships in the native SDKs since version 4.11.0, and the current release is 4.15.4.
Use a Sandbox application while you build. Every Sandbox application has Authentication turned on from the start. A Live application turns Authentication on from the Products page of the console: see Prepare your application.

Install

Add the Didit Maven repository to settings.gradle.kts, then the dependency. It works on its own, or next to the Android verification SDK.
settings.gradle.kts
build.gradle.kts

Set up the redirect and passkeys

Didit returns people to your app through an HTTPS redirect only. Custom URL schemes are not accepted.
  1. In the console, under Authentication > Security and sessions, add your redirect URL, for example https://app.example.com/didit/callback. Copy the publishable key from Authentication > Developers.
  2. Make that address an App Link of your app: publish https://app.example.com/.well-known/assetlinks.json with the delegate_permission/common.handle_all_urls relation for your package and signing certificate.
  3. Declare the SDK’s redirect activity with that App Link in AndroidManifest.xml. tools:node="replace" replaces the library’s unexported declaration, so add xmlns:tools="http://schemas.android.com/tools" to the root <manifest> element if it is not there.
AndroidManifest.xml
For passkeys, register your package and SHA-256 signing-certificate fingerprints with PUT native-apps/ on the Authentication management API. Passkeys need Android 9 or later. Keep Sandbox and Live applications, their keys and their redirect URLs separate.

Sign in

The hosted sign-in is bound to its start with PKCE (S256) and a random state, and a redirect for any other sign-in is refused. Closing the tab throws cancelled. Refresh tokens rotate and Didit revokes the session when a used one comes back, so every DiditAuth instance of the application refreshes under one lock and only once. A session Didit ended (revoked, expired, a reused refresh token) reads as signed out. reauthenticate asks the signed-in person to sign in again, on the hosted page or with DiditReauthMethod.PASSKEY, and returns their new session. It throws not_signed_in without a session and step_up_user_mismatch when a different person signs in: that new session is ended and the current one stays. A backup restored on another device cannot be decrypted, so the person signs in again there. DiditSession holds userId, sessionId, applicationId, vendorData, email, emailVerified, phone, methods, mfaVerified, verified, organizations and expiresAt. vendorData is the id that ties the person to their verifications and transactions: see keep one person across products.

Verify the token on your backend

Send getToken() to your backend as a Bearer token and verify it there, against the issuer’s JWKS at <origin>/.well-known/jwks.json, before you trust it. Use a server SDK or see tokens and JWKS. Call getToken() right before each request: after a refresh, the previous access token stops working at GET session/ and DELETE session/.

Step-up before sensitive actions

DiditStepUpAction.Payout, BankAccount and ContactChange follow the step-up rules of your application. When a rule applies, the identity check opens on the hosted page. The result is what Didit recorded when the person came back: not_required, approved, pending, review, declined or expired.

Errors

Every call throws DiditAuthException with a code. The code is the Didit API’s own (invalid_grant, method_unavailable, reauthentication_required) or one of cancelled, invalid_state, not_signed_in, step_up_user_mismatch, passkey_cancelled, passkey_unavailable, browser_unavailable, storage_unavailable, invalid_publishable_key, network_error, rate_limited (with retryAfterSeconds) and server_error. A sign-out without network still signs the person out on the device.

Connect verification and monitoring

Your backend derives vendor_data from the verified token. It creates verification sessions or mints scoped monitoring tokens for that person, and returns only the session credential or scoped token to your app. The API key stays on the server. Use the Android verification SDK for identity verification, and follow SDK transaction submission for monitoring. Treat sign-in, verification and transaction decisions separately.

Test it

Test a cold start, background and foreground transitions, closing the tab, token expiry, MFA, sign-out and signing in as another person, on a device.
Last modified on November 21, 2026