What are PublicKeyCredentialRequestOptions in WebAuthn?
Vincent
Created: December 18, 2023
Updated: April 30, 2025
What are PublicKeyCredentialRequestOptions?#
PublicKeyCredentialRequestOptions is an important object in the
WebAuthn standard, used during the login with
a credential. They are essential for the navigator.credential.get() function, providing
the necessary data to generate an authentication assertion.
As shown in the flowchart for the login process, passing publicKeyCredentialRequestOptions
to the Frontend is the first step by the Backend during authentication. A crucial part is
the cryptographic challenge that is later signed by
the authenticator.
Technical breakdown#
Here's a quick explanation of all attributes, as specified in the
WebAuthn specification.
userVerification is an optional value to specify requirements for
user verification during the operation. Possible values
are “preferred” (default), “required” or “discouraged”.
allowCredentials#
"allowCredentials": [],
allowCredentials is an optional list of credentials
that are allowed for authentication, indicating the caller’s preference by descending
order. This list would be filled with PublicKeyCredentialDescriptors, as you can see in
this article.
extensions#
"extensions": []
extensions contains optional request(s) for additional processing, such as specific
return values. e.g.
credProbs requests information on whether the created credential is discoverable
What is the significance of the challenge member in PublicKeyCredentialRequestOptions?#
The challenge is a critical security feature that ensures the authenticity of the
authentication process and guards against replay attacks.
Can PublicKeyCredentialRequestOptions be customized for specific authentication needs?#
Yes, they offer flexibility with optional parameters like timeout and rpId, allowing
customization based on specific authentication requirements.
What’s the difference between PublicKeyCredentialRequestOptions and PublicKeyCredentialCreationOptions?#
They both are objects sent by the Backend including a challenge for authentication, but
differ regarding their use case.
PublicKeyCredentialCreationOptions are
used for creating a new credentials, while PublicKeyCredentialRequestOptions are used
for the authentication process with an existing credential
Add passkeys to your app in <1 hour with our UI components, SDKs & guides.