Okta OIDC not behaving correctly on Android

I am trying to implement an authentication flow using okta-react-native on iOS and Android. On iOS it works perfectly but on Android, the redirect does not work properly. The user is never redirected back to the app, if not previously logged in and if they were logged in, the get “User cancelled a session”.

No further error is presented in the logs.

The steps are as follows:

  • App makes a login request to our API
  • The API returns a special response that is then used to initialize Okta, via createConfig
  • await signInWithBrowser(); is then called
  • That successfully opens up the browser and the user can login
  • The user is never redirected back to the app. There is an attempt to redirect the user but they end up back on the browser
  • If the user attempts again, meaning the session is still alive on Okta’s side, they are just met with User cancelled a session

This flows works as expected on iOS. However, I suspect that some Android logic is missed but I’m not sure how. I’d be happy to provide code snippets that might shed some light.

Using

"@okta/okta-react-native": "^2.9.1",

Hello,

Do you see this on all Android devices?

Can you test the Okta browser redirect sample on the same device and see if the same happens.
https://github.com/okta/samples-js-react-native/tree/master/browser-sign-in.

Thank You,

Yeah, all devices and emulators

Also, I actually can’t run the examples at all, running into an expo related issue that I can’t resolve:

Error: Unable to resolve module ./.expo/.virtual-metro-entry