Passkeys
Enable passkeys and understand their browser, domain, and SDK requirements.
Passkeys let a customer authenticate using a credential held by their authenticator, such as the platform authenticator on their phone or computer. The private key stays with the authenticator; Unidy verifies the signed challenge using the registered public key.
Enable and register a passkey
- In the intended brand, open Customization → Enabled Login Methods and enable Passkey. You need permission to edit the brand's login configuration.
- Sign in to the customer's hosted profile using an existing method.
- Add a passkey, give it a recognizable name, and complete the device's verification prompt.
- Sign out and choose Login with Passkey on the hosted sign-in screen. Verify that the correct account and brand journey open.
The hosted profile supports adding and removing passkeys, with a limit of ten per account. Keep a working recovery method before removing a credential or changing devices.
Registration currently requests a platform authenticator and requires user verification. Do not promise enrollment of a roaming USB security key through this flow. The user's device and browser determine the verification prompt and whether a credential is available through their platform account.
There is no dedicated dashboard passkey-management screen. Customers can manage their own credentials from the hosted profile without dashboard access.
Domain and origin requirements
Unidy derives the WebAuthn relying-party ID from the registrable domain of the brand host, falling back to the host itself when necessary.
| Brand host | Typical relying-party ID |
|---|---|
accounts.example.com | example.com |
members.example.com | example.com |
accounts.other.example.org | example.org |
Brands with the same relying-party domain can use credentials registered for that domain. Different relying parties require separate enrollment. This does not remove account, brand-connection, or application authorization requirements.
The browser must accept the relying-party ID for the calling origin. Adding an arbitrary host to an SDK allowlist cannot override that browser rule. Serve the application over HTTPS and choose a compatible brand/application domain arrangement before implementing passkeys.
Unidy's verification allowlist includes the brand origin, configured issuer origins, and HTTP origins derived from SDK-client allowed destinations. Configure the SDK client for the intended brand and origin as well as meeting the browser's relying-party rules.
SDK sign-in sequence
SDK passkey authentication uses a challenge request, the browser's credential API, and an assertion submission:
| Step | Request | Result |
|---|---|---|
| Create challenge | GET /api/sdk/v1/passkeys/new, optionally with sid | WebAuthn request options and an encrypted challenge cookie. A known sign-in can narrow the allowed credentials. |
| Ask the authenticator | navigator.credentials.get() | A signed assertion after customer verification. |
| Verify assertion | POST /api/sdk/v1/passkeys with publicKeyCredential | 201 with SDK authentication data and a sign-in ID on success. |
Both HTTP requests require the SDK application key. Send browser credentials on both calls so the challenge cookie can make the round trip. The cookie expires after five minutes and uses Secure, HttpOnly, and SameSite=None; browser third-party-cookie policy can still block it.
For a complete SDK application, prefer the JavaScript SDK or React SDK. The following browser helper shows the raw exchange, including the required binary conversions:
function decodeBase64Url(value) {
const base64 = value.replace(/-/g, '+').replace(/_/g, '/');
const padded = base64 + '='.repeat((4 - base64.length % 4) % 4);
return Uint8Array.from(atob(padded), (character) => character.charCodeAt(0));
}
function encodeBase64Url(value) {
const bytes = new Uint8Array(value);
let binary = '';
for (const byte of bytes) binary += String.fromCharCode(byte);
return btoa(binary).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
}
async function signInWithPasskey({ baseUrl, sdkKey, sid }) {
if (!window.PublicKeyCredential) {
throw new Error('Passkeys are not supported in this browser.');
}
async function request(path, init = {}) {
const response = await fetch(new URL(path, baseUrl), {
...init,
credentials: 'include',
headers: {
Authorization: `Bearer ${sdkKey}`,
'Content-Type': 'application/json',
},
});
const data = await response.json();
if (!response.ok) {
const error = new Error(data.error_identifier || 'Passkey request failed.');
error.status = response.status;
throw error;
}
return data;
}
const query = sid ? `?sid=${encodeURIComponent(sid)}` : '';
const options = await request(`/api/sdk/v1/passkeys/new${query}`);
const publicKey = {
...options,
challenge: decodeBase64Url(options.challenge),
allowCredentials: options.allowCredentials?.map((credential) => ({
...credential,
id: decodeBase64Url(credential.id),
})),
};
const credential = await navigator.credentials.get({ publicKey });
if (!credential) throw new Error('No passkey was selected.');
const assertion = credential.response;
const publicKeyCredential = {
id: credential.id,
rawId: encodeBase64Url(credential.rawId),
type: credential.type,
clientExtensionResults: credential.getClientExtensionResults(),
response: {
clientDataJSON: encodeBase64Url(assertion.clientDataJSON),
authenticatorData: encodeBase64Url(assertion.authenticatorData),
signature: encodeBase64Url(assertion.signature),
userHandle: assertion.userHandle ? encodeBase64Url(assertion.userHandle) : null,
},
};
return request('/api/sdk/v1/passkeys', {
method: 'POST',
body: JSON.stringify({ publicKeyCredential }),
});
}Invoke this helper from a customer action. On success, give the response to your application's SDK session handling; do not log the returned tokens. On cancellation or rejection, keep another enabled sign-in method available and request a new challenge for the next attempt. Do not automatically loop the authenticator prompt.
The Passkey setting governs the hosted surfaces and SDK presentation. The SDK passkey endpoint does not itself apply that brand feature gate, so hiding the method is not a substitute for revoking an unwanted registered credential or session.
Troubleshooting
| Symptom | Check |
|---|---|
| Browser refuses the relying-party ID | Confirm that the calling origin is compatible with the brand's relying-party domain. SDK allowed-host configuration alone cannot fix this. |
SDK 400 bad_request | The assertion or challenge cookie is missing. Check HTTPS, credentials: 'include', cookie policy, and expiry; start again with a new challenge. |
SDK 401 invalid_passkey | The assertion refers to a credential not registered with this Unidy account system. Choose another credential or use recovery. |
SDK 401 verification_failed | Verification failed. Start a new challenge and check origin, relying-party ID, and the assertion serialization. |
Browser NotAllowedError | The customer cancelled, the request timed out, or the browser could not use an eligible credential. Offer another sign-in method without treating cancellation as a server failure. |
| Security key cannot enroll | This enrollment flow requests a platform authenticator. Use a supported platform credential. |