okta / okta-mobile-kotlin

Okta's Android Authentication SDK
https://okta.github.io/okta-mobile-kotlin/
Apache License 2.0
32 stars 11 forks source link

Redirect not happening if app is put into background #286

Open jiaqi-transcarent opened 3 months ago

jiaqi-transcarent commented 3 months ago

Describe the bug?

We just found out that during the MFA flow, if you tap "send email", then put the app to the background and tap on verify email in the email you just get, then come back to the app, the sign-in widget gets stuck in the "signing in" page and does not redirect.

The app redirects fine if you keep the app in the foreground and tap on the email elsewhere (say on your desktop).

I think this might be related to Custom Tab's lifecycle and here are some other issues that might be related:

Not Redirecting Redirecting

What is expected to happen?

User is redirected after verifying email and coming back to the app.

What is the actual behavior?

User is stuck on "signing in".

Reproduction Steps?

Okta sign-in widget for authentication and enable MFA flow.

Additional Information?

No response

SDK Version and Artifact(s) used.

okta-mobile-kotlin: 1.7.21 Android 14

Build Information

No response

rajdeepnanua-okta commented 3 months ago

Hi @jiaqi-transcarent, we are aware of this bug. I filed a ticket with Chromium team here: https://issues.chromium.org/issues/328662559 Google team suggested us steps to collect more logs. From further Chrome navigation logs analysis, I realized that this bug (on our side) is happening because of the following:

  1. Okta Sign-in widget (the login page popped up for Browser redirect) starts polling the backend for email verification
  2. App gets backgrounded
  3. Verification happens while app is in the background
  4. Sign-in widget receives a valid redirect while it's polling in the background
  5. Sign-in widget tries to redirect while the app is backgrounded. Because the app is in background, the redirect is dropped. This is the root cause of the issue.

This is unfortunately not something that can be fixed in this SDK. It is an issue with the Sign-in widget, and I am working on redirecting this issue to the correct teams.

For now, I will keep this issue open and will provide updates on when the issue is fixed on SIW side.

jiaqi-transcarent commented 3 months ago

Hi @rajdeepnanua-okta, understood and thanks for your quick response!