Auth0 error: Uncaught SyntaxError: Unexpected token '!'

I’m following the steps to ingrate authentication with Auth0. I’ve got the above error. Here’s a screenshot of the code that throws the error.

I made the change for import { Auth0Client }. I’m running redwoodjs 0.8.2, node 12.16.3

Screen Shot 2020-06-05 at 3.53.40 PM

I found the problem. I was running both CLI and manual commands.

yarn rw g auth

AND

cd web
yarn add @redwoodjs/auth @auth0/auth0-spa-js

I only need to run the CLI command.

1 Like

Hmpf. I wonder why it failed when you added auth0; my assumption is that it should’ve said: “hey, you’ve already installed this…”

1 Like

@peterp. It doesn’t prevent me running the command.

I’m hitting another error with auth0. I traced into mapAuthClientAuth0 and found domainUrl is undefined.

Could you show me the code where auth0 is instantiated? It should be in ./src/web/index.js

@peterp, here’s the code with auth: https://github.com/vidalab/vida/blob/auth/web/src/index.js#L15

I traced this further. Looks like process.env is empty. I can see process.env variables in the master branch (running 0.6 version). Can redwoodjs version upgrade affect process.env?

It should not, have you defined the AUTH_* env vars yourself? in <projectRoot>/.env

Here are some docs for setting up auth0: https://github.com/redwoodjs/redwood/tree/master/packages/auth#for-auth0

We should probably give more instructions when you initialize the editor: https://github.com/redwoodjs/redwood/issues/664