-
Get the required payload for
/register/start
endpoint:final res = await AuthService.passKeyRegisterInit(username: username!);
-
Send the payload to Credential Manager to initiate the user approval flow for registration:
final credResponse = await AuthService.credentialManager.savePasskeyCredentials(request: res);
-
After user approval, send the data to
/register/complete
API for verification and user creation:final user = await AuthService.passKeyRegisterFinish( username: username!, challenge: res.challenge, request: credResponse, );
-
Make a GET request to
/login/start
endpoint to retrievechallenge
and other payload:final res = await AuthService.passKeyLoginInit();
-
Initiate the user approval flow for sign-in by sending the request data from
/login/start
toCredentialManager
:final credResponse = await AuthService.credentialManager.getPasswordCredentials( passKeyOption: CredentialLoginOptions( challenge: res.challenge, rpId: res.rpId, userVerification: res.userVerification, ), );
-
Verify the user by sending the data returned from
getPasswordCredentials
method to/login/complete/
endpoint to retrieve the user object:final user = await AuthService.passKeyLoginFinish( challenge: res.challenge, request: credResponse.publicKeyCredential!, );