okta / okta-react-native

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

Use native callbacks instead of promise in createConfig #404

Closed rajdeepnanua-okta closed 10 months ago

rajdeepnanua-okta commented 10 months ago

Looks good. Are you planning to trigger a release for this, to enable testing of this update?

Yep. @shuowu-okta can help us with releasing this. I'll add the release docs

chukcha-wtf commented 10 months ago

@rajdeepnanua-okta great work on this PR! Can you please update the documentation for using createConfig?

I see that here https://github.com/okta/okta-react-native/blob/fd592da9d60b52946fc79bc6fb3fdcfd5fec63ad/index.js#L140 createConfig is still marked as async call but there's nothing in the function itself that will follow the async/await pattern anymore.

I see that createConfig is now relying on callbacks but can't find a way to pass an onSuccess/onError callbacks to the createConfig call so there's no way to notify the app that createConfig() has resolved with either success or error. Or at least I've failed to find one.

And when I've tried calling createConfig like this:

  createConfig({
        clientId: "clientId", // actual value is different
        redirectUri: 'com.redirect:/',
        endSessionRedirectUri: 'com.redirect:/logout',
        discoveryUri: "issuerParam", // actual value is different
        scopes: ['openid', 'profile', 'offline_access'],
        requireHardwareBackedKeyStore: false,
    });

I started getting the fillowing error (it worked just fine in previous releases):

[[90,159,87],[10,0,0],[[18,25],[86,2000,1705519960326,false]],214]
Error: Exception in HostFunction: Malformed calls from JS: field sizes are different.
nikolal commented 10 months ago

I can confirm I also have the same error:

Exception in HostFunction: Malformed calls from JS: field sizes are different

rajdeepnanua-okta commented 10 months ago

@chukcha-wtf, the createConfig function contract remains the same as before. It's using callbacks internally, and the changes don't affect the API exposed to you. @chukcha-wtf, @nikolal, are you encountering this issue on Android or iOS? I'm looking into this issue now.

nikolal commented 10 months ago

@rajdeepnanua-okta

I am experiencing this issue on IOS but I don't think it is connected to this MR.

It's happening on older versions too. -----> Not true, see EDIT below.

It started when i upgraded this lib earlier today so my error search brought me to this MR.

EDIT:

Actually it only happens on 2.11.0

I managed to make it work on 2.10.0 and ^2.8.0.

rajdeepnanua-okta commented 10 months ago

@chukcha-wtf, @nikolal, we have released 2.11.1 which fixes issues with iOS, and also some hard to hit issues for Android. Let me know if it helps