I have this code from the website, informing me how to setup the WebAuth function of Auth0. I put it in my application and am receiving an unexpected token error on the equals sign that is to the right of the variable weba.
import auth0 from 'auth0-js';
export default class Auth {
weba = new auth0.WebAuth({
domain: 'bobsburgers.auth0.com',
clientID: 'T6SjpXYPWBvbFwLts3YbXKVQd4gCxUvp',
redirectUri: 'http://localhost:3000/callback',
audience: 'https://bobsburgers.auth0.com/userinfo',
responseType: 'token id_token',
scope: 'openid'
});
login() {
this.weba.authorize();
}
}
I have been debugging for the past hour and haven’t had any understanding of why this error is being thrown. Any thoughts?
@chasen-bettinger have you previously declared the weba
variable? Which website are you referring to? Are you able to share the error message you are receiving?
You’re probably trying to use class fields
, which is still in stage 3 proposal, in a browser that doesn’t support it. You need to compile this code a compatible javascript version.
Proposal: GitHub - tc39/proposal-class-fields: Orthogonally-informed combination of public and private fields proposals
Babel-transform: @babel/plugin-proposal-class-properties · Babel
Babel-repl: Babel · The compiler for next generation JavaScript
1 Like
This link here: https://manage.auth0.com/#/applications/T6SjpXYPWBvbFwLts3YbXKVQd4gCxUvp/quickstart
Sorry for being ambiguous.
The error message is quite literally:
utils/AuthService.js: Unexpected token (17:7)
lock = new Auth0Lock(config.AUTH_CONFIG.clientId, config.AUTH_CONFIG.domain, {
^
I have since changed it from WebAuth to Auth0Lock. Everything else constant.
Can you follow one of our quickstarts? Auth0
It’s easier if you start with a technology you already know.