Auth0 Home Blog Docs

Google Login returning only code and state query parameters

auth0
google
#1

Hi,

I’m using auth.js (v9.9.0) and logging in fine with username\password. However, when I try to log in with a social provider (Google), the callback doesn’t have the usual #access_token=..... in the url, but instead has ?code=...&state=... and the parseHash function is returning both nulls for the error and authResult.

I’m using the example from Auth0 for the handleAuthentication() function:

        return new Promise((resolve, reject) => {
            this.auth0.parseHash((err, authResult) => {
                if (err) {
                    console.log("Err:" + err);
                    return reject(err);
                }
                if (!authResult || !authResult.idToken) {
                    console.log("authResult:" + authResult);
                    console.log("Err:" + err);
                    return reject(err);
                }
                console.log('Logged in');
                this.setSession(authResult);
                resolve();
            });
        })

I’m using Auth0’s keys for the Google login and I believe I’ve set it all up correctly, but clearly missing something.

Hope someone can help me out!

Cheers,
Russ

1 Like