Skip to content

TypeScript API / @laikacms/server/oauth2 / generateWebAuthnScript

Function: generateWebAuthnScript() ​

ts
function generateWebAuthnScript(
   passkeyOptions, 
   verifyUrl, 
   authMessages?
): string;

Generate WebAuthn JavaScript with embedded options for passkey authentication. Options are embedded directly in the script to avoid an extra round-trip. If options with allowCredentials are provided, the script will automatically attempt passkey login.

Parameters ​

ParameterTypeDescription
passkeyOptionsPasskeyAuthOptions | nullThe WebAuthn authentication options (publicKey object)
verifyUrlstringThe URL to POST the authentication response to
authMessages?{ authenticating: string; authenticationFailed: string; dividerOr: string; emailLabel: string; emailPlaceholder: string; forgotPasswordLink: string; loginButton: string; noCredentialReturned: string; pageTitle: string; passkeyAuthFailed: string; passkeyOptionsNotAvailable: string; passwordLabel: string; passwordPlaceholder: string; signInButton: string; signingInWithPasskey: string; signInWithPasskey: string; }Optional localized messages for the script
authMessages.authenticating?string-
authMessages.authenticationFailed?string-
authMessages.dividerOr?string-
authMessages.emailLabel?string-
authMessages.emailPlaceholder?string-
authMessages.forgotPasswordLink?string-
authMessages.loginButton?string-
authMessages.noCredentialReturned?string-
authMessages.pageTitle?string-
authMessages.passkeyAuthFailed?string-
authMessages.passkeyOptionsNotAvailable?string-
authMessages.passwordLabel?string-
authMessages.passwordPlaceholder?string-
authMessages.signInButton?string-
authMessages.signingInWithPasskey?string-
authMessages.signInWithPasskey?string-

Returns ​

string

Released under the MIT License.