How Passkey Authentication Works
Guile supports two passkey authentication flows through a unified challenge API:Usernameless Authentication (Recommended)
The most seamless experience where users authenticate without entering any identifier: Key benefits:- No username or email required
- Faster sign-in experience
- Works across all user’s devices with passkeys
Username-First Authentication
Traditional flow where users provide their identifier first: When to use:- User prefers to enter their identifier
- Fallback when usernameless fails
- Backward compatibility with existing flows
Registering a Passkey
Before users can authenticate with passkeys, they must register at least one:- Get registration options - Call
POST /auth/passkeyRegistrationOptionsto obtain WebAuthn credential creation options - Create credential - Use the WebAuthn API to create a discoverable credential
- Register passkey - Call
POST /auth/passkeysto send the credential to the server
- Stores user information on the authenticator device
- Enables usernameless authentication
- Works for both authentication flows
Registration Options Structure
The API returns human-readable field names for easy integration:relyingParty- Information about your application (not abbreviated as “rp”)publicKeyCredentialParameters- Supported algorithms (not abbreviated as “pubKeyCredParams”)algorithm- Cryptographic algorithm enum values likeES256,RS256(not numeric codes)
Supported Algorithms
The API supports these cryptographic algorithms (COSE identifiers):- ES256 (recommended) - ECDSA with SHA-256, widely supported
- RS256 - RSASSA-PKCS1-v1_5 with SHA-256
- EdDSA - EdDSA (Ed25519)
- ES384 - ECDSA with SHA-384
- ES512 - ECDSA with SHA-512
Discoverable Credentials
All passkeys in Guile are created as discoverable credentials with these characteristics:- Resident keys: Stored on the authenticator device itself
- User information included: Contains user identifier for server lookup
- Browser discoverable: Can be found without server input
- Cross-device sync: Syncs across user’s devices (platform-dependent)
authenticatorSelection.residentKey: "required"authenticatorSelection.requireResidentKey: true
Unified Challenge API
Passkey authentication uses the same unified challenge endpoints as OTP authentication:Challenge Creation: POST /auth/challenges
Request body:
Verification: POST /auth/verifiedChallenges
Request body:
Authentication Flow Details
Usernameless Flow
- Call
POST /auth/challengeswithmethod: "passkey"(no identifier) - The API returns WebAuthn options with an empty
allowCredentialsarray - The browser discovers available passkeys from the device’s keychain
- User selects a passkey and verifies their identity
- Call
POST /auth/verifiedChallengeswithmethod: "passkey"and theassertion - The server extracts the credential ID, identifies the user, and verifies the assertion
- Receive access and refresh tokens
Username-First Flow
- User provides their email or phone number
- Call
POST /auth/challengeswithmethod: "passkey"and the identifier (phoneNumberoremailAddress) - The API returns WebAuthn options with the user’s passkeys in
allowCredentials - The browser shows only that user’s passkeys
- User selects a passkey and verifies their identity
- Call
POST /auth/verifiedChallengeswithmethod: "passkey"and theassertion - Receive access and refresh tokens
Security Considerations
Passkeys provide strong security guarantees:- Phishing resistant: Credentials are bound to the domain
- No shared secrets: Private keys never leave the device
- Biometric verification: User presence and verification required
- Replay protection: Each assertion includes a unique challenge
Managing Passkeys
Users can manage their registered passkeys:- List passkeys: View all registered passkeys with device names and last used timestamps
- Delete passkeys: Remove passkeys from lost or replaced devices
- Multiple passkeys: Register passkeys on multiple devices for convenience
Best Practices
- Offer both flows: Support usernameless for convenience and username-first as fallback
- Clear labeling: Use “Sign in with passkey” for usernameless, “Use passkey” for username-first
- Device naming: Encourage users to name passkeys descriptively (e.g., “iPhone 15 Pro”)
- Graceful fallback: Provide OTP authentication as backup using the same unified endpoints
- User education: Explain passkey benefits during registration
- Field mapping: Your client SDK should map human-readable field names (like
relyingParty,algorithm) to WebAuthn specification names - Algorithm support: Use ES256 as the primary algorithm for maximum compatibility
Browser Support
Passkeys are supported in modern browsers:- Chrome/Edge 108+
- Safari 16+
- Firefox 119+