Skip to main content
Didit’s didit_auth package signs your Flutter app’s end users up and in with Didit Authentication on Android and iOS. It opens your application’s hosted Didit page, supports passkeys, keeps the session in the iOS Keychain or the Android Keystore, and handles sign-out and step-up. It is published on pub.dev at version 0.1.1 and wraps the native Authentication modules at release 4.15.1.
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.

Requirements

Below iOS 17.4 the hosted page cannot return to an HTTPS redirect, so signIn fails with browser_unavailable, and so does stepUp when a check has to run. Session, token and sign-out calls are not affected. The package runs on Android and iOS only: on any other platform every call throws DiditAuthUnavailableException.

Install

Identity verification has its own package, didit_sdk. Both can be installed in one app, because they pin the same native release.

Set up the redirect and passkeys

Didit sends the person back to your app with an HTTPS redirect, and accepts no custom URL schemes. Register the redirect URI under Authentication > Security and sessions and copy the publishable key from Authentication > Developers in the console, then follow the setup of each platform: On Android nothing else is needed: the package adds Didit’s Maven repository to your build and resolves me.didit:didit-auth from it. On iOS with Swift Package Manager (Flutter 3.24 or later, flutter config --enable-swift-package-manager) nothing else is needed either. With CocoaPods, name the Didit podspec at the pinned version in ios/Podfile and set the iOS 15 floor:
With didit_sdk in the same app, keep its DiditSDK/... line: DiditSDK/Auth is part of every variant, so you do not add a second line.

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 page throws cancelled. A session Didit ended (revoked, expired, a reused refresh token) reads as signed out: currentSession and getToken return null. reauthenticate asks the signed-in person to sign in again, on the hosted page or with method: 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. Refresh tokens stay in the Keychain or the Android Keystore and never reach Dart. 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

DiditPayoutStepUp, DiditBankStepUp and DiditContactStepUp 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 and a message, plus status, fields and retryAfter (seconds) when Didit sent them. 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, invalid_redirect_uri, invalid_request, network_error, rate_limited (with retryAfter) and server_error. The codes are the same on Android and iOS. 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 Flutter 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 page, token expiry, MFA, sign-out and signing in as another person, on a device of each platform.
Last modified on November 21, 2026