refactor : Deprecate the existing MFA APIs in AuthenticationAPIClient#932
refactor : Deprecate the existing MFA APIs in AuthenticationAPIClient#932
AuthenticationAPIClient#932Conversation
There was a problem hiding this comment.
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, andmultifactorChallengeas 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.
auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.kt
Outdated
Show resolved
Hide resolved
auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.kt
Outdated
Show resolved
Hide resolved
auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.kt
Show resolved
Hide resolved
auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.kt
Outdated
Show resolved
Hide resolved
AuthenticationAPIClientAuthenticationAPIClient
|
please update EXAMPLES.md too |
|
| * MFA application such as Google Authenticator or Guardian. | ||
| * @return a request to configure and start that will yield [Credentials] | ||
| */ | ||
| @Deprecated( |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
The advantage of using replaceWith is that this will automatically let the IDE make the suggested changes. Two caveat in this scenario is
- we have added new error types for all these APIs instead of the exisiting
AuthenticationException. - 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
Changes
This PR deprecates the existing MFA apis in the
AuthenticationAPIClient. Users are requested to use the new APIs defined in theMfaApiClientclass insteadChecklist
I have read the Auth0 general contribution guidelines
I have read the Auth0 Code of Conduct
All existing and new tests complete without errors