React-Native client sdk samples not working

I’m trying to initiate a login from a React-Native app but am having no success with the documentation I’ve been able to find.
The Samples provided in the guide (https://developer.okta.com/quickstart/#/react-native/nodejs/express), downloaded and executed from github run, but nothing happens when pressing the login button. I also followed the instructions from the readme of the new SDK (https://github.com/okta/okta-oidc-js/tree/master/packages/okta-react-native) give the same result.
I’ve also tried using schematics 0.9.0 (following this: OktaDev Schematics 0.9.0: Now with React Native Support!) which is by far the easiest btw, but this gives a similar result, pressing the login button gives an Authorization Error, -600 error response.
In no case has the browser has opened to ask for credentials and no activity shows on the Okta logs so it feels like it must be some sort of configuration issue, but I’m at a loss to know what.
I’ve used the config settings as described in various places, my config looks like this:

    clientId: '0oa1s762u6H38j0jJ357',
    redirectUri: 'com.okta.dev-686719:/callback',
    endSessionRedirectUri: 'com.okta.dev-686719:/callback',
    discoveryUri: 'https://dev-686719.okta.com/oauth2/default',
    scopes: ['openid', 'profile', 'offline_access'],
    requireHardwareBackedKeyStore: false,

Any advice would be much appreciated.

Thanks

This tutorial I wrote last month might help. It worked when I wrote it.

@mraible: Thanks, very good tutorial… The only real difference between it and the one I used from the okta dev forums on schematics 0.9.0 was the specific versions of schematics, react-native-cli etc. Initially the end result worked identically to the one I did previously (i.e. it did not open the browser window) either in a virtual device or my physical device.

I subsequently went and created a new AVD with the versions you used (Pixel 3, Android 10 and Api v29) and it worked :-). I then also went and deleted and recreated the AVD I was using previously (Pixel 3 with Android 9, API v28) and it also then worked so I’m still unclear as to why it didn’t work previously.

However it still does not work on my physical device which is Android 8, I’m guessing possibly the version is too old. I will also try doing a factory reset and trying again.

One note for your tutorial, when creating the application on Okta, it should be noted that the user must use the default login redirect URI (in the tutorial it’s given as an “e.g.”), otherwise one gets a invalid redirect_uri error.

Thanks again for your help, for the tutorial and for the schematics scripts, definitely the easiest way to get going.

Hi @nixonad,

We are running into similar behavior testing our app in a pre-android 9.0 environment.

The tutorial talks about minSdkVersion of 19 (Android 4.4 - KitKat), so we were under the impression Okta-RN would support at least the “officially supported” android versions, (8.0+), but running it on Android 8.0 and 8.1 renders our “sign-in” button useless, as it does not trigger any browser to open.

Any idea if there is additional configuration needed to make it work in these older versions of android?

Thanks :slight_smile:

Hi @TobiGe,
I unfortunately haven’t been able to get mine to work on Android 8 on my physical device, but I haven’t done much further investigation.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.