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
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.