Consumer Authentication

/

API reference

/

Passkeys & WebAuthn

/

Authenticate

/

Start

Start WebAuthn authentication

POSThttps://test.stytch.com/v1/webauthn/authenticate/start

Initiate the authentication of a Passkey or WebAuthn registration.

To optimize for Passkeys, set the return_passkey_credential_options field to true.

After calling this endpoint, the browser will need to call navigator.credentials.get() with the data from public_key_credential_request_options passed to the navigator.credentials.get() request via the public key argument. We recommend using the get() wrapper provided by the webauthn-json library.

If you are not using the webauthn-json library, the public_key_credential_request_options will need to be converted to a suitable public key by unmarshalling the JSON and converting some the fields to array buffers.


Body parameters


return_passkey_credential_optionsboolean

user_idstring

domain*string

Response fields


status_codeint

request_idstring

user_idstring

public_key_credential_request_optionsstring
curl --request POST \
  --url https://test.stytch.com/v1/webauthn/authenticate/start \
  -u 'PROJECT_ID:SECRET' \
  -H 'Content-Type: application/json' \
  -d '{
    "domain": "example.com",
    "user_id": "user-test-16d9ba61-97a1-4ba4-9720-b03761dc50c6"
  }'

RESPONSE

200
{
  "status_code": 200,
  "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
  "user_id": "user-test-16d9ba61-97a1-4ba4-9720-b03761dc50c6",
  "public_key_credential_request_options": "{\"allowCredentials\":[{\"id\":\"AUnfDtA+myCDdumkKnVp2Sk0MIWCPXQVL2mG3h+xQBvLEF+MmNqvj2ZwNIY8id5UHz7ogZKmGgc0mM9yYVhdJNU1n6nIwPBGUuZpr3N18trqXMKxejYYKwCO4BmSHA==\",\"type\":\"public-key\"},],\"challenge\":\"hYZtLNT9SIgZqPnKfbnQX3nCJ7NavTT_S6oC9XREYv0F\",\"rpId\":\"example.com\",\"timeout\":300000,\"userVerification\":\"discouraged\"}"
}

Common Error Types