auth0-samples / auth0-react-sample

130 stars 149 forks source link

Auth0 is not a constructor #36

Closed brandonmp closed 7 years ago

brandonmp commented 7 years ago

Reproduce:

Clone this repo

populate .env

npm install/npm start in 02-Custom-Login

go to localhost:3000

Error:

Uncaught TypeError: _auth0Js2.default is not a constructor
    at new AuthService (eval at <anonymous> (http://localhost:3000/app.js:3150:2), <anonymous>:34:19)
    at eval (eval at <anonymous> (http://localhost:3000/app.js:3144:2), <anonymous>:32:12)
    at Object.<anonymous> (http://localhost:3000/app.js:3144:2)
    at __webpack_require__ (http://localhost:3000/app.js:556:30)
    at fn (http://localhost:3000/app.js:87:20)
    at eval (eval at <anonymous> (http://localhost:3000/app.js:3138:2), <anonymous>:14:15)
    at Object.<anonymous> (http://localhost:3000/app.js:3138:2)
    at __webpack_require__ (http://localhost:3000/app.js:556:30)
    at fn (http://localhost:3000/app.js:87:20)
    at eval (eval at <anonymous> (http://localhost:3000/app.js:660:2), <anonymous>:21:15)

Also happens when I try to replicate the AuthService class in my app.

Tangential, but is there some serious flux in the auth0 sdks recently? This is the third or fourth Auth0 React starter kit I've tried today where I've hit a dead-end just by following auth0 docs/tutorials. Willing to accept that I'm botching it over-and-over somehow, but haven't had this kind of trouble in the past w/ other auth providers.

brandonmp commented 7 years ago

outdated docs problem looks like. someone can close if you like but I'm going to leave open, as your auto-generated docs seem to point to the v8 sdk (on your CDN) but still include syntax for v7, so that at least seems like an open issue

image

vmartynets commented 7 years ago

This issue is fixed by last commit https://github.com/auth0-samples/auth0-react-sample/commit/4d278d5c60ac9f1d9f062d835dfe06cf9ebd5270

amitvchaudhary commented 7 years ago

Hi @brandonmp and @Amialc ,

I am still facing this issue. I just followed those auto-generated docs and stumbled upon this error:

TypeError: __WEBPACK_IMPORTED_MODULE_3_auth0_js__.webAuth is not a constructor

In my package.json I have below:

"auth0-js": "^8.9.1",

Please let me know the solution.