Skip to content

refactor : Deprecate the existing MFA APIs in AuthenticationAPIClient#932

Open
pmathew92 wants to merge 3 commits intomainfrom
deprecate_mfa
Open

refactor : Deprecate the existing MFA APIs in AuthenticationAPIClient#932
pmathew92 wants to merge 3 commits intomainfrom
deprecate_mfa

Conversation

@pmathew92
Copy link
Contributor

Changes

This PR deprecates the existing MFA apis in the AuthenticationAPIClient . Users are requested to use the new APIs defined in the MfaApiClient class instead

Checklist

@pmathew92 pmathew92 requested a review from a team as a code owner March 6, 2026 11:40
Copilot AI review requested due to automatic review settings March 6, 2026 11:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR deprecates the legacy MFA helper methods on AuthenticationAPIClient in favor of the newer MFA flow APIs exposed by MfaApiClient, guiding consumers toward the newer surface area.

Changes:

  • Marked loginWithOTP, loginWithOOB, loginWithRecoveryCode, and multifactorChallenge as deprecated.
  • Added deprecation messages indicating removal in the next major SDK version and pointing users to MfaApiClient.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pmathew92 pmathew92 changed the title deprecate : Deprecate the existing MFA APIs in AuthenticationAPIClient refactor : Deprecate the existing MFA APIs in AuthenticationAPIClient Mar 6, 2026
NandanPrabhu
NandanPrabhu previously approved these changes Mar 6, 2026
@NandanPrabhu
Copy link
Contributor

please update EXAMPLES.md too

@NandanPrabhu NandanPrabhu self-requested a review March 6, 2026 11:57
@pmathew92
Copy link
Contributor Author

please update EXAMPLES.md too
@NandanPrabhu done

* MFA application such as Google Authenticator or Guardian.
* @return a request to configure and start that will yield [Credentials]
*/
@Deprecated(
Copy link
Contributor

Choose a reason for hiding this comment

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

please make it in one line :
message = "loginWithOTP is deprecated and will be removed in the next major version. Use MfaApiClient.verify(MfaVerificationType.Otp) instead.",

reason:
the display to developers when using in their ids will show in one line.

Same can be done for:
(loginWithOTP)
(loginWithOOB)
(loginWithRecoveryCode)
(multifactorChallenge)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is single line. It is being shown as two line here in the PR

* @return a request to configure and start that will yield [Credentials]
*/
@Deprecated(
message = "loginWithOTP is deprecated and will be removed in the next major version of the SDK. Use the APIs in the [com.auth0.android.authentication.mfa.MfaApiClient] class instead.",
Copy link
Contributor

Choose a reason for hiding this comment

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

we can use replaceWith so that
users get a warning and IDE help to actually migrate.
e.g
replaceWith = ReplaceWith(
expression = "mfaClient(mfaToken).verify(MfaVerificationType.Otp(otp))",
imports = ["com.auth0.android.authentication.mfa.MfaVerificationType"]

Same for others

Copy link
Contributor Author

@pmathew92 pmathew92 Mar 6, 2026

Choose a reason for hiding this comment

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

The advantage of using replaceWith is that this will automatically let the IDE make the suggested changes. Two caveat in this scenario is

  1. we have added new error types for all these APIs instead of the exisiting AuthenticationException.
  2. We need to define the exact API client name for replacing the existing API. Since the new flow requires us to create an instance of mfaApiClient which the user might not have created or would have created with a different name. Both case can cause errors and might confuse users.
    Hence I thought to keep it simple

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.

5 participants