Decode and verify the id_token
Following a successful registration or authentication operation, your frontend will receive a code. This can be exchanged for a Principal, representing the outcome of the operation:
import { Passlock } from '@passlock/browser';
const passlock = new Passlock({ tenancyId });
const result = await passlock.authenticatePasskey({ authenticationToken});
if (result.success) { // send this to your backend console.log(result.value.id_token);}import { Passlock } from '@passlock/server';
const passlock = new Passlock({ tenancyId, apiKey });
const result = await passlock.verifyIdToken({ id_token });
if (result.success) { // will be a Principal console.log(result.value);}Behind the scenes, verifyIdToken uses the jose library to decode and verify the JWT, before transforming it into a Principal.