Skip to content

feat: Add My Account API support for managing authentication methods#1552

Open
subhankarmaiti wants to merge 27 commits into
masterfrom
feat/my-account-api
Open

feat: Add My Account API support for managing authentication methods#1552
subhankarmaiti wants to merge 27 commits into
masterfrom
feat/my-account-api

Conversation

@subhankarmaiti
Copy link
Copy Markdown
Contributor

@subhankarmaiti subhankarmaiti commented May 28, 2026

Summary

  • Adds My Account API client (myAccount property) for managing user authentication methods
  • Supports passkey enrollment (challenge + verify), phone, email, TOTP, push notification, and recovery code enrollment with OTP/non-OTP confirmation
  • Adds CRUD operations for authentication methods (get, list, update, delete) and factor listing
  • Introduces MyAccountError class exposing type, title, detail, and statusCode properties matching native SDK error surfaces
  • Implements native bridge layer for both iOS (Swift) and Android (Kotlin)
  • Uses per-call accessToken pattern for thread safety (no cached client)

New Public API

  • myAccount.passkeyEnrollmentChallenge({ accessToken, ... })
  • myAccount.enrollPasskey({ accessToken, ... })
  • myAccount.enrollPhone({ accessToken, phoneNumber, preferredAuthenticationMethod? })
  • myAccount.enrollEmail({ accessToken, emailAddress })
  • myAccount.enrollTOTP({ accessToken })
  • myAccount.enrollPushNotification({ accessToken })
  • myAccount.enrollRecoveryCode({ accessToken })
  • myAccount.confirmPhoneEnrollment({ accessToken, id, authSession, otpCode })
  • myAccount.confirmEmailEnrollment({ accessToken, id, authSession, otpCode })
  • myAccount.confirmTOTPEnrollment({ accessToken, id, authSession, otpCode })
  • myAccount.confirmPushNotificationEnrollment({ accessToken, id, authSession })
  • myAccount.confirmRecoveryCodeEnrollment({ accessToken, id, authSession })
  • myAccount.getAuthenticationMethods({ accessToken, type? })
  • myAccount.getAuthenticationMethodById({ accessToken, id })
  • myAccount.updateAuthenticationMethodById({ accessToken, id, name?, preferredAuthenticationMethod? })
  • myAccount.deleteAuthenticationMethodById({ accessToken, id })
  • myAccount.getFactors({ accessToken })

Error Handling

  • Passkey methods throw PasskeyError
  • All other My Account methods throw MyAccountError

Test plan

  • Verify TypeScript compiles (npx tsc --noEmit)
  • Test passkey enrollment flow on iOS 16.6+
  • Test phone/email enrollment + OTP confirmation
  • Test TOTP enrollment + confirm with authenticator code
  • Test recovery code enrollment + confirm
  • Test get/update/delete authentication methods
  • Test getFactors

@subhankarmaiti subhankarmaiti requested a review from a team as a code owner May 28, 2026 12:17
Comment thread android/src/main/java/com/auth0/react/MyAccount.kt Outdated
Comment thread android/src/main/java/com/auth0/react/MyAccount.kt
Base automatically changed from feat/passkeys-support to master May 29, 2026 06:08
Comment thread android/src/main/java/com/auth0/react/A0Auth0Module.kt
Comment thread android/src/main/java/com/auth0/react/A0Auth0Module.kt Outdated
Comment thread src/types/parameters.ts
/**
* Represents a generic authentication method returned by the My Account API.
*/
export interface AuthenticationMethod {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a single authentication method suffice or do you think we can have granular authentication methods for each factors inheriting from a common interface. Let me know your thoughts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Granular would be better, But none of our native SDK is doing that today. So making it similar to the Native SDKs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

@subhankarmaiti subhankarmaiti May 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But for swift we do not have this, we can handle it later I feel, as improvement.
ref: https://github.com/auth0/Auth0.swift/blob/master/Auth0/MyAccount/AuthenticationMethods/GetAuthenticationMethodsResponse.swift

Comment thread src/types/parameters.ts Outdated
Comment thread EXAMPLES.md
Comment thread android/src/main/java/com/auth0/react/A0Auth0Module.kt Outdated
pmathew92
pmathew92 previously approved these changes May 29, 2026
…djust null handling in authentication method updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants