Skip to main content

How to Add Passkey Sign-In to an iOS App with the Didit Auth SDK

In DiditAuth 4.15.4, sign in on the hosted page, then call registerPasskey while the session is at most five minutes old. Returning users call signInWithPasskey. Test on a physical iPhone.

How to Add Passkey Sign-In to an iOS App with the Didit Auth SDK

Contents

In this guide

Jump to the part you need.

Passkey sign-in on iOS with Didit fits apps already using Didit Authentication and wanting a passwordless path. In DiditAuth 4.15.4, signInWithPasskey and registerPasskey use ASAuthorization. The signIn method opens the hosted page through ASWebAuthenticationSession. Authentication is free for the first 50,000 active users each month. The caveats: hosted pages need iOS 17.4, and registerPasskey needs a session at most five minutes old. Test on a physical iPhone, because the simulator does not always validate Associated Domains.

Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.

The answer at a glance

Passkey sign-in with Didit on iOS, at a glance
ItemValue
PackageDiditAuth, from the Didit iOS SDK
Version used here4.15.4, through Swift Package Manager or the CocoaPods Auth subspec
Passkey callssignInWithPasskey(from:) and registerPasskey(from:) use ASAuthorization
Hosted page callsignIn(from:) uses ASWebAuthenticationSession
SetupHTTPS redirect, Associated Domains, app ID registration for passkeys
Minimum iOSiOS 15 for the DiditAuth module, iOS 17.4 for hosted sign-in and step-up pages
PriceFirst 50,000 active users each month free, then $0.02 per active user per month
Where to testA Sandbox application on a physical iPhone

Start free in the sandbox, with no sales call. For developers working with an AI assistant, connect Didit through the MCP server. The product reference is the Didit Authentication product page; the code reference is the iOS quickstart, and published prices are on didit.me/pricing.

The outcome and the method we recommend

You want a person to tap a button and sign in with a passkey held on their iPhone, where the credential belongs to your Didit application rather than to a server you run. For a person who needs to enroll a passkey, start with hosted sign-in. The hosted page handles sign-up and any MFA, bot protection or verification your configuration requires. Once the person has a passkey, offer native passkey sign-in.

If you also build custom web sign-in screens with sign_in_ui: "own", your screens handle intermediate steps such as MFA enrollment and protection challenges. Web passkeys belong to your application's sign-in origin. If your custom screens run on another domain, send users to the hosted page for web passkey sign-in.

Everything below runs against a Sandbox application, which has Authentication turned on from the start. A Live application turns Authentication on from the Products page of the console, as described in prepare your application.

Biometric authentication walkthrough by Didit
Didit Authentication covers biometric and passwordless entry; passkeys are one of the methods the hosted page offers.

Prerequisites

  • An Xcode project with a deployment target of iOS 15 or later. The standalone DiditAuth module needs iOS 15 and you write import DiditAuth.
  • A Didit organization and a Sandbox application. Every Sandbox application has Authentication on from the start.
  • An HTTPS redirect URL registered in the console under Authentication > Security and sessions, for example https://app.example.com/didit/callback. Didit returns people to your app through an HTTPS redirect only. Custom URL schemes are not accepted.
  • Control of the web host behind the redirect, so you can serve https://app.example.com/.well-known/apple-app-site-association.
  • A physical iPhone. The simulator does not always validate Associated Domains.
  • No Didit API key and no secret inside the app. The publishable key is public, and the code exchange is protected by PKCE instead of a client secret.

Step by step

Step 1: Install DiditAuth 4.15.4

With Swift Package Manager, add the package at 4.15.4 and add the DiditAuth product to your target.

// Package.swift
.package(url: "https://github.com/didit-protocol/sdk-ios.git", from: "4.15.4"),
// In your target's dependencies:
.product(name: "DiditAuth", package: "sdk-ios"),

With CocoaPods, use the Auth subspec. The podspec URL embeds the git tag, which must equal the SDK version you install. Never point it at main.

podspec_url = 'https://raw.githubusercontent.com/didit-protocol/sdk-ios/4.15.4/DiditSDK.podspec'

pod 'DiditSDK/Auth', :podspec => podspec_url

Install one or the other, not both. Every verification variant of the iOS verification SDK already includes DiditAuth, and an app that installs a verification variant keeps import DiditSDK.

Step 2: Register the redirect and copy the publishable key

In the console, under Authentication > Security and sessions, add your redirect URL, for example https://app.example.com/didit/callback. Then copy the publishable key from Authentication > Developers. Keep Sandbox and Live applications, their keys and their redirect URLs separate.

Step 3: Publish the associated domains file

iOS checks two things before it opens the hosted page. First, the redirect's host must be listed in your app's Associated Domains entitlement as webcredentials:app.example.com. Second, https://app.example.com/.well-known/apple-app-site-association must list your app as TEAMID.bundle.id under webcredentials. This is the redirect host check.

Step 4: Register your app ID for passkeys

Passkeys need one more entry: the passkey host check. Register your app ID with PUT native-apps/ on the Authentication management API, then add webcredentials:<your application's Didit host> to your Associated Domains too. A redirect URL on that same Didit host also satisfies step 3. The documented management base is https://apx.didit.me/auth/v2/organizations/{org_id}/applications/{application_id}/authentication/. Credentials can be an application API key sent as x-api-key (a full-access key for this application, or a key for this application with authentication set to write), an owner-approved grant with didit:management sent as a Bearer token, or a console session. Keep those privileged credentials out of the iOS app; the app only needs the publishable key. The request contract is in the native apps section.

Step 5: Make sure the passkey method is on

Passkeys need no credentials of their own, but hosted sign-in shows only the methods you enabled. Enable it the same way as any other method, with PUT methods/passkey/ and an enabled value of true on the Authentication management API. Use the same credential as step 4: a full-access key for this application, or a key for this application with authentication set to write. A read-back with GET lists each method with enabled and credential_source.

Step 6: Create one DiditAuth instance

One instance per application. Create it once and keep it, because every instance of the application refreshes under one lock and only once.

Step 7: Enroll with hosted sign-in, then register a passkey

The calls below come from the quickstart. This Sandbox version uses pk_test_... and keeps enrollment separate from returning-user sign-in. Enrollment path and OS versions: the standalone DiditAuth module requires iOS 15. Hosted sign-in and step-up require iOS 17.4. The iOS quickstart says signInWithPasskey can still work below iOS 17.4 with an existing passkey. Verify it on each device and OS version you intend to support.

import DiditAuth // or DiditSDK, in an app that installed a verification variant

// One instance per application.
let auth = try DiditAuth(publishableKey: "pk_test_...", redirectUri: "https://app.example.com/didit/callback")

// First sign-in: hosted page, then enroll a passkey immediately.
let session = try await auth.signIn(from: viewController)
let passkeyId = try await auth.registerPasskey(from: viewController) // needs a session at most five minutes old

For a returning person with an existing passkey on this device, use the passkey call alone:

// Returning person with an existing passkey on this device.
let passkeySession = try await auth.signInWithPasskey(from: viewController)

Step 8: Read the session and the token

currentSession() returns the session, cached for 30 seconds, and force: true asks Didit now. getToken() returns an optional string. When it returns a token, send that five-minute JWT to your backend as a Bearer token. Tokens stay in the Keychain on this device only, under kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly. Refresh tokens rotate, and Didit revokes the session when a used one comes back. A session Didit ended, whether revoked, expired or refreshed with a reused token, reads as signed out.

let current = try await auth.currentSession() // DiditSession?
let token = try await auth.getToken() // String?

Step 9: Verify the token on your backend

Send the token 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. Verify the ES256 signature, then check iss, aud, exp and typ on every protected request; typ is at+jwt. Reject a token whose act claim is non-null unless the route accepts AI agents. Call getToken() right before each request: after a refresh, the previous access token stops working at GET session/ and DELETE session/. It can still pass offline verification until it expires, so sensitive actions need a live GET /session/ check. The full contract is in tokens and JWKS.

Step 10: Step up before a sensitive action

let result = try await auth.stepUp(.payout(amount: "900.00", currency: "EUR"), from: viewController)
if result.isApproved {
    // Your backend confirms with GET step-up/{result.id}/ before it pays out.
}

.payout, .bankAccount and .contactChange follow the step-up rules of your application. When a rule applies, the identity check opens on the hosted page, and the result is what Didit recorded. Your backend confirms it itself with GET step-up/{result.id}/ before it pays out.

Reauthentication is separate from step-up. reauthenticate asks the signed-in person to sign in again and returns a new Authentication session. With method: .passkey, it uses the passkey. It is not an approved step-up result, which your backend reads with GET step-up/{result.id}/.

A liveness check recorded inside a Didit session in the Business Console
A liveness check recorded in the Business Console. Step-up approval is confirmed by your backend with GET step-up/{result.id}/.

Step 11: Sign out

signOut() signs out on the device at once and then ends the session at Didit when Didit is reachable.

try await auth.signOut()

What you should see

  • A successful registerPasskey call returns a passkey ID.
  • A successful signInWithPasskey call returns a session without asking the user to type an email address or password.
  • currentSession() returns a DiditSession carrying userId, sessionId, applicationId, vendorData, email, emailVerified, phone, methods, mfaVerified, verified, organizations and expiresAt. The methods field is listed among the DiditSession fields; do not treat it as a confirmed passkey assertion.
  • getToken() returns an optional string. When it returns a token, your backend verifies the token's signature and required claims before accepting it.
  • stepUp returns a result with an id and isApproved, and your backend reads the same result with GET step-up/{result.id}/.
  • vendorData is the id that ties the person to their verifications and transactions across products.

Device test sequence

Run this on a physical iPhone against the Sandbox application.

  1. First sign-in: tap the hosted sign-in button. Success: the hosted page opens and returns to https://app.example.com/didit/callback; currentSession() returns a DiditSession.
  2. Enrollment: immediately call registerPasskey. Success: the Apple passkey sheet appears and the call returns a passkey ID.
  3. Local sign-out: call signOut(). Success: the app reads as signed out at once.
  4. Returning-user passkey sign-in: call signInWithPasskey. Success: the passkey sheet appears and returns a session with no email or password typed.

Failure cases and recovery

What each Didit Auth error on iOS means and what to do next
SymptomCauseRecovery
browser_unavailable from signIn or stepUpThe hosted pages need iOS 17.4, and the system cannot present the sign-in page below thatGate hosted calls to iOS 17.4 or later. For users with an existing passkey, offer signInWithPasskey on earlier iOS versions only after testing the device and OS combinations you support.
Hosted page never opens on the simulatorThe simulator does not always validate Associated DomainsRetest the same build on a physical iPhone. If hosted sign-in still fails, check the redirect host's entitlement and confirm its apple-app-site-association file lists your app ID under webcredentials.
Passkey sheet never appears on deviceFirst check the Associated Domains entitlement webcredentials:<Didit host>; second check the app ID registration with PUT native-apps/Add the missing entitlement, register the app ID on the management API, rebuild and reinstall the app.
registerPasskey fails on the sessionThe session is older than five minutesRun signIn or reauthenticate again, then call registerPasskey immediately.
cancelledThe person closed the hosted pageClosing the hosted page throws cancelled. Offer the sign-in button again.
not_signed_in from reauthenticateThere is no session to re-authenticateCall signIn or signInWithPasskey first.
step_up_user_mismatch from reauthenticateA different person signed in during reauthentication. Didit ends the new session and keeps the original one.Ask the original user to try again.
The redirect comes back with an exchange errorThe code is unknown, used or expired, or the verifier or redirect_uri does not matchCheck that the redirect URL is registered exactly as sent, and complete the exchange within 60 seconds.
The app reads as signed out after a refreshDidit ended the session: revoked, expired, or a reused refresh tokenStart a new sign-in. Treat it as normal, not as an exception.

Inputs and outputs

Everything the passkey flow passes in and gets back
Input or outputValueWhere it comes from or goes
Publishable keypk_test_... in Sandbox, pk_live_... in LiveAuthentication > Developers
Redirect URIhttps://app.example.com/didit/callbackAuthentication > Security and sessions
Associated Domains entrieswebcredentials:app.example.com and webcredentials:<Didit host>Xcode entitlement
Association file/.well-known/apple-app-site-association listing TEAMID.bundle.idYour web host
App ID for passkeysTEAMID.bundle.idPUT native-apps/
Passkey methodenabled: truePUT methods/passkey/
registerPasskey inputA session at most five minutes oldsignIn or reauthenticate
registerPasskey outputA passkey IDYour app
currentSession() outputDiditSession? with the fields aboveYour app
getToken() outputAn optional string; when present, a five-minute JWTYour backend, as a Bearer token
stepUp outputid and isApprovedYour backend, confirmed with GET step-up/{id}/
signOut()Local sign-out at once, remote when reachableYour app

What is paid, and where your configuration sets the boundary

Passkey registration and passkey sign-in are Authentication. Didit bills Authentication on active users, not on passkeys: the first 50,000 active users each month are free, and later active users are $0.02 per active user per month. Sandbox testing is free and unlimited, so the whole build above costs nothing while you work.

Authentication is priced by monthly active users. If your integration also runs paid identity checks, budget for those separately. If your configuration requires an identity check at sign-up, sign-in or step-up, those checks bill separately at their published module prices. Read your workflow in the console before you forecast.

The boundaries are your own configuration: which methods are enabled, your MFA policy, your sign-up policy, and your step-up rules. A Live application is a separate application from your Sandbox one, with its own keys, redirect URLs and passkeys, so plan a second setup pass when you go live.

Worked cost example

Take an app with 120,000 people signing in each month, all through passkeys. The first 50,000 active users are free, so 120,000 minus 50,000 leaves 70,000 billable active users. At list price that is 70,000 times $0.02 = $1,400.00 a month.

For Authentication alone, assuming the full monthly credit is available, Growth is 70,000 × $0.0192 + $99.00 - $115.00 = $1,328.00. Scale is 70,000 × $0.018 + $299.00 - $350.00 = $1,209.00.

Separately, 2,000 completed full ID checks at list price cost 2,000 × $0.33 = $660.00 a month. Each check is ID document verification $0.15, passive liveness $0.10, face match 1:1 $0.05 and device and IP analysis $0.03. These are separately completed full ID checks, not a bundle assigned to a payout rule. Passkeys add nothing on top of the active user price.

Sources

Start free in the sandbox, with no sales call. Set up your redirect and Associated Domains, register your app ID, then enroll a passkey and test sign-in on a physical iPhone.

Try it

Try this in the sandbox

Run the check this guide describes, free.

ID Verification

The product this post is about, taken from its topic. Run it free in the sandbox.

$0.15 per checkStart free

Author

Alberto Rosas

Co-founder and CEO

Alberto Rosas

Alberto Rosas

Co-founder and CEO

About Didit

Questions

Frequently asked questions

How do I add passkey sign-in to an iOS app with the Didit Auth SDK?

Install the DiditAuth product from the Didit iOS SDK at 4.15.4. Register your HTTPS redirect URL and copy the publishable key. Serve the apple-app-site-association file, list webcredentials:app.example.com in Associated Domains, register your app ID with PUT native-apps/ and add webcredentials:<your Didit host>. Then call signInWithPasskey(from:) for an existing passkey, or signIn(from:) followed by registerPasskey(from:) within five minutes of that session to create one.

What is the browser_unavailable error in the Didit Auth SDK?

The standalone DiditAuth module requires iOS 15, and hosted sign-in and step-up require iOS 17.4; below that, those calls throw browser_unavailable because the system cannot present the page. The iOS quickstart says signInWithPasskey can still work below iOS 17.4 with an existing passkey. Verify it on each device and OS version you intend to support.

Why does Didit hosted sign-in not open in the iOS simulator?

The simulator does not always validate Associated Domains. Retest the same build on a physical iPhone. If hosted sign-in still fails, check the redirect host's entitlement and confirm its apple-app-site-association file lists your app ID under webcredentials.

Why does registerPasskey fail with a session error?

registerPasskey requires a session at most five minutes old. If the person spent longer than that on the previous screen, the call fails. Run signIn or reauthenticate again and call registerPasskey immediately after it returns.

Does passkey sign-in cost extra on Didit?

No. Passkey registration and passkey sign-in are part of Authentication, which is free for the first 50,000 active users each month and then $0.02 per active user per month. If your integration also runs paid identity checks, budget for those separately at their published module prices.

Do I install DiditAuth or DiditSDK?

Install one, not both. The standalone DiditAuth module needs iOS 15 and you write import DiditAuth. Every DiditSDK verification variant already includes it, and an app that installs a verification variant keeps import DiditSDK.

Where does the Didit Auth SDK store tokens on iOS, and how long do they last?

Tokens stay in the Keychain on that device only, under kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly. getToken() returns an optional string; when it returns a token, it is a five-minute JWT renewed before it expires. Refresh tokens rotate, and Didit revokes the session if a used one comes back.

How does my backend verify the token from getToken()?

Send it as a Bearer token and verify the ES256 signature against the issuer's JWKS at <origin>/.well-known/jwks.json, then check iss, aud, exp and typ on every protected request; typ is at+jwt. Reject a token whose act claim is non-null unless the route accepts AI agents. Call getToken() right before each request, because after a refresh the previous access token stops working at GET session/ and DELETE session/; it can still pass offline verification until it expires, so sensitive actions need a live session check.

Can I use one host for my redirect and passkeys?

Yes. A redirect URL on your application's Didit host also satisfies the redirect host requirement, as documented in the iOS quickstart. Add webcredentials:<your application's Didit host> to Associated Domains and register your app ID with PUT native-apps/.

What happens when someone closes the hosted sign-in page?

Closing the hosted page throws cancelled. Offer the sign-in button again. 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.

Does passkey sign-in work on iOS 15 and 16?

Passkey sign-in is native ASAuthorization, not the hosted page. The DiditAuth module requires iOS 15, and the iOS quickstart says signInWithPasskey can still work below iOS 17.4 with an existing passkey. Hosted sign-in and step-up need iOS 17.4. Verify it on each device and OS version you intend to support.

Compliance built in

Audited, certified and attested.

We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center

  • Regulation encoded into your flows

    Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.

  • Ready for AMLR

    Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.

  • Tested in Spain's Treasury sandbox

    Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.

  • Audited, not self-declared

    iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.

Compliance assistant

Your obligations · 3 regions

EU · AMLRCustomer due diligence, human reviewCovered
Illinois, Texas, ColoradoExplicit biometric consentCovered
Germany · Youth protectionVerified adults only (JMStV)Covered
Workflow checked. Every obligation is met
  • SOC 2 Type 2
  • ISO 27001
  • iBeta Level 1 and Level 2
  • EU regulator attestation
  • FSM youth protection
  • GDPR
  • EBA remote onboarding
  • MiCA compatible
  • FIDO Alliance member
  • AMLREU AML Regulation ready

Integration · Didit MCP

Run Didit from your own AI agent

Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.

Add to ClaudeChatGPT
Didit Academy · Lesson 04 · Use Didit with MCP
  • Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
  • Run investigationsAsk why a session was declined, review cases, search people and companies.
  • Change rulesCreate payment rules, test them on past data and switch them on.
  • Pull reportsAsk for numbers, exports or the audit log.

Verify your first user today.

Start free

Free sandbox. Credit applies to work-email sign-ups.