okta / okta-react-native

OIDC enablement for React Native applications
https://github.com/okta/okta-react-native
Other
58 stars 39 forks source link

Browser not opening after signInWithBrowser() method #220

Open VovaK1 opened 3 years ago

VovaK1 commented 3 years ago

Hello everyone!

I'm submitting a:

Current behavior

When I call the signInWithBrowser() method, nothing happens, but only a warning appears:

Memory storage can only support simple single user use case on server side, please provide custom storageProvider or storageKey if advanced scenarios need to be supported.

But if we are making a login from our application, with signIn() method then everything works well.

Expected behavior

We need the user to be redirected to a browser on the Okta page, when he can enter credentials and be redirected back to the application.

Can anyone advise?

NikitaAvraimov-okta commented 3 years ago

Please check out native logs(e.g. Android studio) you probably have typo in your configuration

VovaK1 commented 3 years ago

@NikitaAvraimov-okta Thanks for the reply. We can't even run login in sample-app from Okta website. Do you think the reason may be in the settings of the android studio or android configuration?

NikitaAvraimov-okta commented 3 years ago

When I call the signInWithBrowser() method, nothing happens We should see what`s shown at android studio Logcat in case you are experiencing this on android. Please check your build.gradle

manifestPlaceholders = [
                appAuthRedirectScheme: '{customUriScheme}'
        ]

{customUriScheme} has to be replaced with valid redirect uri

VovaK1 commented 3 years ago

@NikitaAvraimov-okta in Logcat we can see this error:

No uri registered to handle redirect or multiple applications registered

Our {customUriScheme} what we indicate is the name of our application. So this is a mistake?

NikitaAvraimov-okta commented 3 years ago

@VovaK1 check out https://developer.okta.com/docs/guides/sign-into-mobile-app/android/define-callback/ e.g. if your redirectUri is redirectUri: 'com.okta.dev-XXXXX:/callback', customUriScheme should be something among these lines com.okta.dev-XXXXX

NikitaAvraimov-okta commented 3 years ago

@VovaK1 You can hide your specific data and show the general pattern of your customUriScheme from build.gradle, most likely problem is there

VovaK1 commented 3 years ago

@NikitaAvraimov-okta I tried com.okta.dev-19063038, also com.okta.dev-XXXXXXXX, but the redirect still doesn't work But I checked another library https://github.com/FormidableLabs/react-native-app-auth with com.okta.dev-19063038 scheme and redirect works well What am I doing wrong?

SMJ93 commented 3 years ago

@VovaK1 Do you have both libraries installed? We experienced a similar problem when having both okta + react-native-app-auth installed. More details here

zayn94 commented 3 years ago

We have also experienced this issue only on android devices. Using some logs we have narrowed it down to a lot of huawei, xiaomi devices and rarely some samsung devices. We have also found that it doesnt like the default browser on these devices and the majority of the time if the user downloads and sets chrome as their default it works. Because its very hard to replicate this issue on our side we ended up working on a native login which is very annoying.