Generate Registration Options
curl -X POST https://your-domain.com/recipe/webauthn/options/register \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"displayName": "John Doe",
"relyingPartyName": "My App",
"relyingPartyId": "example.com",
"origin": "https://example.com",
"timeout": 60000,
"attestation": "none",
"residentKey": "required",
"userVerification": "preferred",
"userPresence": false,
"supportedAlgorithmIDs": [-8, -7, -257]
}'
{
"status": "OK",
"webauthnGeneratedOptionsId": "generated-options-id",
"publicKey": {
"challenge": "base64-encoded-challenge",
"rp": {
"name": "My App",
"id": "example.com"
},
"user": {
"id": "base64-user-id",
"name": "[email protected]",
"displayName": "John Doe"
},
"pubKeyCredParams": [
{"alg": -8, "type": "public-key"},
{"alg": -7, "type": "public-key"},
{"alg": -257, "type": "public-key"}
],
"timeout": 60000,
"attestation": "none",
"authenticatorSelection": {
"residentKey": "required",
"userVerification": "preferred"
}
}
}
User’s email address (will be normalized)
Display name for the user (defaults to email if not provided)
Human-readable name of the relying party (your application)
Relying party identifier (usually your domain)
Origin URL for credential binding
Timeout in milliseconds (default: 60000)
Attestation conveyance preference: “none”, “indirect”, “direct” (default: “none”)
Resident key requirement: “required”, “preferred”, “discouraged” (default: “required”)
User verification requirement: “required”, “preferred”, “discouraged” (default: “preferred”)
Whether user presence is required (default: false)
Array of COSE algorithm identifiers (default: [-8, -7, -257])
“OK” or “INVALID_OPTIONS_ERROR”
webauthnGeneratedOptionsId
Unique identifier for these options (used in subsequent registration call)
WebAuthn PublicKeyCredentialCreationOptions to pass to navigator.credentials.create()
Sign Up with Credential
curl -X POST https://your-domain.com/recipe/webauthn/signup \
-H "Content-Type: application/json" \
-d '{
"webauthnGeneratedOptionsId": "generated-options-id",
"credential": {
"id": "credential-id",
"rawId": "base64-raw-id",
"response": {
"attestationObject": "base64-attestation",
"clientDataJSON": "base64-client-data"
},
"type": "public-key"
}
}'
{
"status": "OK",
"user": {
"id": "user-id",
"isPrimaryUser": false,
"tenantIds": ["public"],
"emails": ["[email protected]"],
"phoneNumbers": [],
"thirdParty": [],
"loginMethods": [
{
"recipeId": "webauthn",
"recipeUserId": "recipe-user-id",
"tenantIds": ["public"],
"email": "[email protected]",
"timeJoined": 1234567890,
"verified": true,
"webauthN": {
"credentialIds": ["credential-id"]
}
}
],
"timeJoined": 1234567890
},
"webauthnCredentialId": "credential-id",
"relyingPartyId": "example.com",
"relyingPartyName": "My App",
"recipeUserId": "recipe-user-id"
}
webauthnGeneratedOptionsId
ID from the options generation response
PublicKeyCredential object from navigator.credentials.create()
“OK”, “INVALID_OPTIONS_ERROR”, “EMAIL_ALREADY_EXISTS_ERROR”, “INVALID_AUTHENTICATOR_ERROR”, “OPTIONS_NOT_FOUND_ERROR”, or “INVALID_CREDENTIALS_ERROR”
Created user object with login methods
The credential ID that was registered
The recipe user ID for this WebAuthn login method
Register Credential for Existing User
curl -X POST https://your-domain.com/recipe/webauthn/user/credential/register \
-H "Content-Type: application/json" \
-d '{
"recipeUserId": "recipe-user-id",
"webauthnGeneratedOptionsId": "generated-options-id",
"credential": {
"id": "credential-id",
"rawId": "base64-raw-id",
"response": {
"attestationObject": "base64-attestation",
"clientDataJSON": "base64-client-data"
},
"type": "public-key"
}
}'
{
"status": "OK",
"webauthnCredentialId": "credential-id",
"recipeUserId": "recipe-user-id",
"email": "[email protected]",
"relyingPartyId": "example.com",
"relyingPartyName": "My App"
}
The recipe user ID to add the credential to
webauthnGeneratedOptionsId
ID from the options generation response
PublicKeyCredential object from navigator.credentials.create()
“OK”, “INVALID_OPTIONS_ERROR”, “INVALID_AUTHENTICATOR_ERROR”, “INVALID_CREDENTIALS_ERROR”, “OPTIONS_NOT_FOUND_ERROR”, “CREDENTIAL_ALREADY_EXISTS_ERROR”, or “UNKNOWN_USER_ID_ERROR”
The credential ID that was registered