Passkey Authentication

Register or login a user using passkeys in your Swift app

Passkey authentication is available on iOS 16+, macOS 12+, tvOS 16+, and visionOS 1+.

Register a new user with a passkey

To create a new user account with a passkey, pass the user’s email address or phone number to passage.registerWithPasskey:

do {
    try await passage.passkey.register(identifier: identifier)
    // Do authenticated stuff
} catch PassagePasskeyError.canceled {
    // User canceled native passkey prompt, do nothing
} catch {
    // Passkey registration failed, try an email or sms registration method instead.
}

Log in an existing user with a passkey

To log in an existing user with a passkey, use passage.passkey.login:

do {
    try await passage.passkey.login(identifier: identifier)
    // Do authenticated stuff
} catch PassagePasskeyError.canceled {
    // User canceled native passkey prompt, do nothing
} catch {
    // Passkey login failed, try an email or sms login method instead.
}