Register WebAuthn credential
Register a new WebAuthn credential for an existing user
POST
/{apiBasePath}/{tenantId}/webauthn/credentialAuthorization
AuthorizationBearer token · headerrequiredReturned as the "st-access-token" header from sign-in and refresh endpoints and present on requests that update the access token payload
or
sAccessTokenAPI key · cookierequiredThis is an HTTPOnly cookie, set by sign-in and refresh endpoints and present on requests that update the access token
Path parameters
apiBasePathstringrequiredIts value depends on the apiBasePath set by the user
tenantIdstringThe tenant against which the request is made. If left empty, the default tenant will be used.
Header parameters
ridstringThe WebAuthn recipe ID
anti-csrftokenThis will only be here if enabled by the user.
Request body
application/jsonwebauthnGeneratedOptionsIdstringrequiredcredentialregistrationPayloadrequiredWebAuthn registration payload
Show propertiesHide properties
idstringrequiredCredential ID
rawIdstringrequiredRaw credential ID
authenticatorAttachmentstringType of authenticator
Allowed:
platformcross-platformclientExtensionResultsobjectClient extension results
responseobjectrequiredRegistration response
Show propertiesHide properties
clientDataJSONstringrequiredClient data JSON
attestationObjectstringrequiredAttestation object
authenticatorDatastringAuthenticator data
transportsstring[]Supported transports
publicKeystringPublic key
publicKeyAlgorithmnumberPublic key algorithm
typestringrequiredCredential type
Allowed:
public-keyResponses
200Credential registration response
One of:
object
statusstatusOKSuccess status indicator
Allowed:
OKgeneralErrorResponse
statusstringError status code
Allowed:
GENERAL_ERRORmessagestringError message
object
statusstringAllowed:
INVALID_CREDENTIALS_ERROROPTIONS_NOT_FOUND_ERRORINVALID_OPTIONS_ERRORINVALID_AUTHENTICATOR_ERRORobject
statusstringAllowed:
REGISTER_CREDENTIAL_NOT_ALLOWEDINVALID_AUTHENTICATOR_ERRORpreasonstring404Resource not found error
string500Internal server error
stringTry it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST "/auth/public/webauthn/credential" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"webauthnGeneratedOptionsId": "opt_123...",
"credential": {
"id": "cred_123...",
"rawId": "base64rawid...",
"authenticatorAttachment": "platform",
"clientExtensionResults": {},
"response": {
"clientDataJSON": "base64clientdata...",
"attestationObject": "base64attestation...",
"authenticatorData": "base64authenticatordata...",
"transports": [
"usb"
],
"publicKey": "base64publickey...",
"publicKeyAlgorithm": -7
},
"type": "public-key"
}
}'const response = await fetch("/auth/public/webauthn/credential", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"webauthnGeneratedOptionsId": "opt_123...",
"credential": {
"id": "cred_123...",
"rawId": "base64rawid...",
"authenticatorAttachment": "platform",
"clientExtensionResults": {},
"response": {
"clientDataJSON": "base64clientdata...",
"attestationObject": "base64attestation...",
"authenticatorData": "base64authenticatordata...",
"transports": [
"usb"
],
"publicKey": "base64publickey...",
"publicKeyAlgorithm": -7
},
"type": "public-key"
}
})
});import requests
response = requests.post(
"/auth/public/webauthn/credential",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
json={
"webauthnGeneratedOptionsId": "opt_123...",
"credential": {
"id": "cred_123...",
"rawId": "base64rawid...",
"authenticatorAttachment": "platform",
"clientExtensionResults": {},
"response": {
"clientDataJSON": "base64clientdata...",
"attestationObject": "base64attestation...",
"authenticatorData": "base64authenticatordata...",
"transports": [
"usb"
],
"publicKey": "base64publickey...",
"publicKeyAlgorithm": -7
},
"type": "public-key"
}
},
)Response
{
"status": "OK"
}"Not Found""Internal Error"