-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
undefined is not an object (evaluating 'window.location.protocol') - React Native #345
Comments
Hi @jdnichollsc, Thanks for the report. |
Hi @aarongranick-okta we were using this version |
We're having the same issue trying to upgrade from 2.11.0. This was the library recommended to us by the Okta engineers so I really hope this gets resolved. |
@mscott-nimbly - For context, are you running this with react-native as well? |
Yes, react native 0.61.5 |
I have the same issue with the latest version, I had to downgrade to 2.11 to make it work |
Internal ref: OKTA-282531 and OKTA-282533 |
Thank you for the reports - at this time we can confirm that you should downgrade to okta-auth-js 2.11.x to retain react-native capability until we are able to address the problem. Edit: The advice below to to use 3.x and set 'pkce: false' is also valid |
I am also using okta-auth-js in a react native app (at the suggestion of Okta support people) so that I can use my own sign in UI. I tried upgrading to 3.0 to stay current and then ran into an issue in react native trying to use
I updated my config to set Do you know why I am seeing this error on mobile and if setting |
I did some digging through the code. The error I mentioned about appears only when I have remote debugging on the react-native app. Without remote debugging I get the same undefined error as the OP. This is why:
So a fix to this for people who want to use version 3.0+ is to either set This library can't use the tokenManager to set cookies in react native anyway so I don't believe there is a security risk. |
@m-stern "This library can't use the tokenManager to set cookies in react native anyway so I don't believe there is a security risk." This is correct. |
My organization is also in need of this fix. We were using okta-auth-js 3.0.0 and ran into issues when running on a real iOS device (vs the simulator). We also noticed that if debug mode is turned off in the simulator, we get the same error: We are hoping this gets fixed soon as we have a react-native-web application, and had to undergo a downgrade for the web application to support the older 2.11 version of this SDK, which contains many breaking changes vs 3.0. |
@offensivelybad The differences you are seeing are because the debugger makes your JS run in a browser environment instead of react native so If you look through the source code for okta-auth-js it only checks Also, I had to do this: |
@m-stern thanks for the help, however I'm still getting the same error. Here's my config, with private data obfuscated:
|
@offensivelybad I suggest looking at this file: https://github.com/okta/okta-auth-js/blob/1b317b64e0cfa1f64df46b76f16b9322617cb029/packages/okta-auth-js/lib/browser/browser.js And searching for the error message you are seeing. The source code is pretty easy to follow. There is likely a check in there that is happening that you can prevent by changing a setting or by setting properties on I am guessing that it is the block at line 74 in that browser.js file that is causing your error.
The easiest way to get rid of the error is to set This will affect your security though if you are trying to run this in a web browser. I was using this library for a react-native mobile app and using it with Okta's oidcjs react native library as well. I had PKCE on in that library. |
this works ! If the issue persists, try |
But we don't have cookies from React Native, only from WebView |
@jdnichollsc - we're trying out #363 to see if it addresses your issue - stay tuned. |
I sent a pull request after checking the last changes, thanks for your help! okta/okta-oidc-js#761 |
Closing this ticket as the original issue should be resolved with the latest version of okta-react-native. Will follow up on okta/okta-oidc-js/issues/761 in that issue. |
It's working very well, thanks for your help! |
Did you find any fix |
Hello guys,
As we can see here,
@okta/okta-auth-js
is a dependecy used from React Native too and we're using this workflow to have a custom native UI to authenticate the users.With the latest version of
@okta/okta-auth-js
we're having this error:Any help is really appreciated! 👍
The text was updated successfully, but these errors were encountered: