You can use Authsignal’s Client SDKs when you want to implement your own custom or native UI. This approach is also useful if you want to add passkeys to your web or mobile app.

1. Backend - Track action

In your app’s backend, track an action which represents what your user is doing, e.g. signIn. You can do this using one of the Authsignal Server SDKs or you can call the Authsignal Server API directly using a RESTful HTTP request.

const result = await authsignal.track({
  userId: user.id,
  action: "signIn",
});

const token = result.token;

2. Frontend - Use a client SDK

Use one of the Authsignal Client SDKs to perform a challenge directly within your app, passing the token from step 1.

const resultToken = await authsignal.passkey.signUp({ token, userName });

3. Backend - Validate challenge

Pass the result token returned by the client SDK to your backend and validate the result of the challenge server-side.

const { state } = await authsignal.validateChallenge({ token: resultToken });

if (state === "CHALLENGE_SUCCEEDED") {
  // The user completed the challenge successfully
  // Proceed with authenticated action or integrate with IdP to create authenticated session
} else {
  // The user did not complete the challenge successfully
}

Next steps