UserSession.completeOAuth2 error in production React app
See original GitHub issueI get the following error when attempting to complete an authentication using UserSession.completeOAuth2:
TypeError: o.opener.parent[("__ESRI_REST_AUTH_HANDLER_" + z)] is not a function
at r (UserSession.js:181)
at Function.e.completeOAuth2 (UserSession.js:222)
at auth.js:41
at c (runtime.js:45)
at Generator._invoke (runtime.js:264)
at Generator.e.<computed> [as next] (runtime.js:98)
at t (asyncToGenerator.js:3)
at z (asyncToGenerator.js:25)
at asyncToGenerator.js:32
at new Promise (<anonymous>)
The app is built off of React (CRA) and is using the latest arcgis-rest packages (2.0.3). It works with no errors in local but fails with this error when deployed to the production site. I am passing a URL parameter through the redirect which I’m not sure is affecting things (popup is set to false).
Even though it fails here and halts the app I can copy/paste the redirect URL that it produces into a new tab and the authentication goes through with no errors.
I’m stumped.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Error occured in react.production.min.js after deploying react ...
so here is the answer of this question! in package.json, i moved react and react-dom to peerDependencies "peerDependencies": { "react": ...
Read more >Adding login authentication to secure React apps
Learn how to secure your React app by implementing basic server-side login authentication for an Express.js server.
Read more >Solved: Use the BeginOAuth2 without a popup - Esri Community
Solved: I am trying to include user authentication into a webpage. I want to use `BeginOAuth2` method from the rest-js library.
Read more >Error Boundaries - React
These errors were always caused by an earlier error in the application code, but React did not provide a way to handle them...
Read more >Experience with Frontend Error Tracking Using Sentry.io In ...
Sign In and create a project Integrate Sentry in app First error ... we are interested in real time error tracking in production...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FYI - this CRA (react-scripts@3.0.0) app uses arcgis-rest-js v2.0.3 and the log in works in prod mode:
https://create-arcgis-app.surge.sh/
Here’s the source:
https://github.com/tomwayson/create-arcgis-app/
I’m going to consider this fixed btw #625 and #652. If anyone experiences this issue again, feel free to re-open.