Skip to content

A simple flutter app for integration for passkey with server side implementation

Notifications You must be signed in to change notification settings

Djsmk123/passkey_example_flutter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Registration

  • 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,
    );

Sign-In

  • Make a GET request to /login/start endpoint to retrieve challenge and other payload:

    final res = await AuthService.passKeyLoginInit();
  • Initiate the user approval flow for sign-in by sending the request data from /login/start to CredentialManager:

    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!,
    );

About

A simple flutter app for integration for passkey with server side implementation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published