okta / okta-oidc-android

OIDC SDK for Android
https://github.com/okta/okta-oidc-android
Other
60 stars 45 forks source link

Sample for MFA enrollment and authorization #343

Closed Jeremy-Brown14 closed 9 months ago

Jeremy-Brown14 commented 1 year ago

Describe the feature request?

Could you please provide a sample implementation for MFA enrollment and challenge for SMS and Okta Verify MFA factors using the AuthClient? It would be wonderful to see a sample of how to implement MFA required, MFA enroll, MFA enroll activate and MFA challenge for Okta Verify and SMS factors using the AuthClient. Thank You!

New or Affected Resource(s)

The functions I need help with implementing is:

object : AuthenticationStateHandlerAdapter() {
    override fun handleMfaRequired(mfaRequiredResponse: AuthenticationResponse) {
         // Does this handler get fired when the user is MFA enrolled, and it requires an MFA Challenge?
    }

    override fun handleMfaEnroll(mfaEnroll: AuthenticationResponse) {
        // Not sure how to handle enrollment
    }

    override fun handleMfaEnrollActivate(mfaEnrollActivate: AuthenticationResponse) {
        // Not sure how to handle activation
    }

    override fun handleMfaChallenge(mfaChallengeResponse: AuthenticationResponse) {
        // Is this where the user provides the MFA challenge response (i.e. Okta Verify Push or SMS verification code)?
    }
}

Provide a documentation link

No response

Additional Information?

No response

rajdeepnanua-okta commented 1 year ago

Hi @Jeremy-Brown14, there is a sample available for this here: https://github.com/okta/samples-android/tree/legacy-samples/custom-sign-in. I believe this file should help with your implementation: NativeSignInWithMFAFragment. We are currently in the process of moving our samples to our new okta-mobile-kotlin SDK, but we don't have currently a sample for this using the newer SDK yet.

Jeremy-Brown14 commented 1 year ago

Thank you so much, this was extremely helpful, I was able to create a SMS Authentication and Okta Verify factor enrollment, factor activation, factor challenge and factor verification.