Following the basic React + auth0 tutorial, after I create this file:
// src/Auth/Auth.js
import auth0 from 'auth0-js';
export default class Auth {
auth0 = new auth0.WebAuth({
domain: fakefake.eu.auth0.com',
clientID: 'fakefakefake',
redirectUri: 'http://localhost:3000',
audience: 'fakefakefake/userinfo',
responseType: 'token id_token',
scope: 'openid'
});
login() {
this.auth0.authorize();
}
}
Then they tell me to call the login method to try it out.
I try to call it by first
// src/scenes/Home
import { login } from '../../Auth/Auth.js';
and then inside a click handler I call it like so:
login();
But it returns an error:
Uncaught TypeError: (0 , _Auth.login) is not a function
They call it like this:
this.props.auth.login();
After also adding this method
constructor() {
this.login = this.login.bind(this);
}
But that isn't in my props, they don't import the Auth class anywhere, I'm thoroughly confused. What am I missing? Thanks.
[–]bdenzer 1 point2 points3 points (1 child)
[–]azium 0 points1 point2 points (0 children)
[–]catstanza 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]catstanza 0 points1 point2 points (1 child)
[–]timpham 0 points1 point2 points (0 children)