Auth0 Home Blog Docs

Problem with ReactJS Quickstart


#1

Just getting started with Auth0. Downloaded the same and had that work, but when I run my own code (barebones Create React App) my handleAuthentication callback never happens. Here is my code:

// App.js

import React, { Component } from ‘react’;
import Auth from ‘./Auth’;
import ‘./App.css’;

class App extends Component {
render() {
return (




);
}

loginClick = () => {
var auth = new Auth();
auth.login();
}
}

export default App;

Here is my Auth class:
import auth0 from ‘auth0-js’;

export default class Auth {
auth0 = new auth0.WebAuth({
domain: ‘some-domain’,
clientID: ‘some-client-id’,
redirectUri: ‘some-redirect-uri’,
responseType: ‘token id_token’,
scope: ‘openid’
});

constructor() {
    this.login = this.login.bind(this);
    //this.logout = this.logout.bind(this);
    this.handleAuthentication = this.handleAuthentication.bind(this);
    //this.isAuthenticated = this.isAuthenticated.bind(this);
}

login() {
    this.auth0.authorize();
}

handleAuthentication() {
    debugger;
}

setSession(authResult) {
    debugger;
}

}

Behavior:
When my login button is pressed I do get the Auth0 login flow and am able to complete it. When login is complete I am able to see my information in (including access token) in the query string. However, my breakpoints never get hit. What am I missing?