okta / okta-react-native

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

Library does not work with react-native-web #412

Closed myou11 closed 9 months ago

myou11 commented 9 months ago

Describe the bug?

This library does not seem to work on the web. My react-native app is used on both native and web platforms. The Okta auth works perfectly on native, but runs into this error on the web: _NativeModules.default.OktaSdkBridge is undefined

There is another library that is wrapping around the okta-auth-js library that seems to work, but I would like to use this library.

What is expected to happen?

Library should work on web as well

What is the actual behavior?

cant find native module on the web

Screenshot 2024-02-08 at 09 52 07

Reproduction Steps?

Additional Information?

No response

SDK Version

2.12.0

Build Information

iOS 17 Xcode 15 Expo 50

rajdeepnanua-okta commented 9 months ago

Hi @myou11, this library is a wrapper around Okta OIDC Android and Okta OIDC iOS. It isn't intended to be used for web, and we never added web support in this library. Okta AuthJS can be used for web use cases.

myou11 commented 9 months ago

Okay that's the conclusion I was coming to after look into it more.

Since my app supports both web and native, I'm guessing I should use platform-specific extensions to create a different okta implementation just for the web? This means I need to pull both @okta/okta-react and @okta/okta-react-native in my RN project

rajdeepnanua-okta commented 9 months ago

Yes, it will need to be done using platform-specific extensions unfortunately. We had never considered web use case earlier. I will bring up this use case internally, and hopefully we can plan something to make this process not as painful in the future.

myou11 commented 9 months ago

Thank you @rajdeepnanua-okta! I will close this for now, but hopefully looking forward to a more streamlined integration that works on web and native!