okta / samples-android

samples-android
https://github.com/okta/samples-android
Apache License 2.0
37 stars 52 forks source link

Custom sign In example not connecting after verify sms code android #63

Closed yahmi closed 3 years ago

yahmi commented 3 years ago

Hello , I followed all step for the sample with mfa login , I have this result , I get the sms code and fill it when click on verify i don't get user information , i get this error " Response state param did not match request state". I tried with postman all calls works fine any one could help me please .

JayNewstrom commented 3 years ago

Could you please confirm you've setup the policy with the steps in our readme? https://github.com/okta/samples-android/tree/master/custom-sign-in#prerequisites

yahmi commented 3 years ago

yes I did all the steps in read me for settings for mfa and assign user for app and groups et policy rules , the result I get it is the sms code is sent when I fill and verify i get this " Response state param did not match request state".

JayNewstrom commented 3 years ago

@NikitaAvraimov-okta could you take a look at this?

NikitaAvraimov-okta commented 3 years ago

@JayNewstrom on it

yahmi commented 3 years ago

Hello guys , @JayNewstrom @NikitaAvraimov-okta do you have any updates please ?

NikitaAvraimov-okta commented 3 years ago

@yahmi We are looking into your issue, I`ll get back to you with some news soon. Thank you

yahmi commented 3 years ago

hello @NikitaAvraimov-okta do you have any update , thank you

NikitaAvraimov-okta commented 3 years ago

hello @NikitaAvraimov-okta do you have any update , thank you

Could you please confirm that this is the exception you get?

image

And could you please confirm that browser sign with mfa works fine for you?

yahmi commented 3 years ago

hello , yet exactly that one , after filling the sms code and verify . Mfa working fine using browser and postman

NikitaAvraimov-okta commented 3 years ago

@yahmi We need to do further research on why this can be happening. For now you can try browser sign-in scenario. Could this flow possibly satisfy your usecase?

yahmi commented 3 years ago

@NikitaAvraimov-okta using browser it works fine i receive code and I can connect , just using native mfa in android i get this error

NikitaAvraimov-okta commented 3 years ago

@yahmi Could you please visit okta admin panel, and share your sign-on policy rules. Go to Security -> Authentication -> Sign-on, then check out rules, you should be seeing "Yes" in front of Prompt for factor.

image

If not, edit existing or create a new rule.

yahmi commented 3 years ago

@NikitaAvraimov-okta yes , I checked it is. already setted up to yes . image

NikitaAvraimov-okta commented 3 years ago

@yahmi and your group "android poc app" does contain a user which you test upon? If yes, do you mind sharing your code on for handling mfa challenge, please

yahmi commented 3 years ago

@NikitaAvraimov-okta yes private void verifyFactor(String factorId, VerifyFactorRequest request) { KeyboardUtil.hideSoftKeyboard(getActivity()); showLoading(); submit(() -> { try { authenticationClient.verifyFactor(factorId, request, new AuthenticationStateHandlerAdapter() { @Override public void handleUnknown(AuthenticationResponse authenticationResponse) { runOnUIThread(() -> { hideLoading(); showMessage(String.format(getString(R.string.not_handle_message), authenticationResponse.getStatus().name())); }); }

                @Override
                public void handleMfaChallenge(AuthenticationResponse mfaChallengeResponse) {
                    runOnUIThread(() -> {
                        hideLoading();
                        showMessage(getString(R.string.mfa_sms_sent_code));
                    });
                }

                @Override
                public void handleSuccess(AuthenticationResponse successResponse) {
                    runOnUIThread(() -> {
                        hideLoading();
                        sendSessionToken(successResponse.getSessionToken());
                    });
                }
            });
        } catch (AuthenticationException e) {
            Log.e(TAG, Log.getStackTraceString(e));
            runOnUIThread(() -> {
                hideLoading();
                showMessage(e.getMessage());
            });
        }
    });
}
NikitaAvraimov-okta commented 3 years ago

@yahmi disable your application level mfa rules, but make sure the ones from "Security -> Authentication -> Sign On" are enabled and you should be good to go

tyfrth commented 3 years ago

Can confirm this works for me

yahmi commented 3 years ago

Thank for the support