feat: add Passkey and MyAccount API support#927
Open
cschetan77 wants to merge 2 commits into
Open
Conversation
Expose `AuthService.passkey` and `AuthService.myAccount` as Observable-based API clients, wrapping the corresponding clients from `@auth0/auth0-spa-js`. - `passkey.signup()` and `passkey.login()` handle the full WebAuthn challenge-response flow and call `authState.refresh()` on success so that `isAuthenticated$` and `user$` update automatically. - `myAccount` provides Observable wrappers for all seven MyAccount API operations: getFactors, getAuthenticationMethods, getAuthenticationMethod, deleteAuthenticationMethod, updateAuthenticationMethod, enrollmentChallenge, and enrollmentVerify. - `ObservablePasskeyApiClient` and `ObservableMyAccountApiClient` interfaces added to `interfaces.ts`, consistent with the existing `ObservableMfaApiClient` pattern. - All passkey and MyAccount error classes and types re-exported from the public API surface. - Bump `@auth0/auth0-spa-js` minimum to `^2.21.0` where these APIs were introduced. - 31 new unit tests covering delegation, return values, state side-effects, and error propagation for both API clients.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for the Passkey and MyAccount APIs to the
auth0-angularSDK, exposing them as Observable-based clients onAuthService— consistent with how the existingmfaclient is structured.Passkey API (
AuthService.passkey)Wraps the
passkeyclient from@auth0/auth0-spa-js. Both methods handle the full WebAuthn challenge-response flow internally:passkey.signup(options)— register a new user with a passkey credentialpasskey.login(options?)— authenticate an existing user via passkey assertionBoth methods call
authState.refresh()on success so thatisAuthenticated$anduser$update automatically, consistent with other authentication flows in the SDK.MyAccount API (
AuthService.myAccount)Wraps the
myAccountclient from@auth0/auth0-spa-js, providing Observable versions of all seven account management operations:getFactors()getAuthenticationMethods(type?)getAuthenticationMethod(id)deleteAuthenticationMethod(id)updateAuthenticationMethod(id, data)enrollmentChallenge(options)enrollmentVerify(options)Other changes
ObservablePasskeyApiClientandObservableMyAccountApiClientinterfaces added tointerfaces.ts, following theObservableMfaApiClientpatternPasskeyError,PasskeyRegisterError,PasskeyChallengeError,PasskeyGetTokenError,MyAccountApiError) and types re-exported from the public API surface@auth0/auth0-spa-jsminimum version bumped to^2.21.0where these APIs were introducedTest plan
auth.service.spec.tscovering: correct delegation to the underlying SDK, expected return values,authState.refresh()called after passkey authentication, and error propagation for all methodsauth.service.spec.tspass (npm test -- --testPathPattern=auth.service.spec)Usage