Auth0 Home Blog Docs

Auth0-lock Login with Google Connection returns empty idTokenPayload

Excuse the probably common problem but this has been vexing with no answers I can find anywhere:

When I use auth0-lock.js to login using a google-auth2 connection I do not get an idTokenPayload although the login is successful. When this is performed with a Username-Password-Connection the idTokenPayload is fully populated.

I am using a fully authorized Google Connection (not the development connection) and the login works but not the payload. When I test the google connection via Auth0 Dashaboard I get the full profile as expected for the login. My Auth0-lock configuration is as follows:
auth: {
params: { scope: “openid profile email”, prompt: ‘select_account’ },
audience: “http://myhost/myapi”,
autoParseHash: true,
redirect: false,
responseType: “id_token token”,
sso: false,
rememberLastLogin: false,
allowedConnections: [‘google-oauth2’, ‘Username-Password-Authentication’]
},

// login is performed as such 
this.lock.on( "authenticated", _doAuthentication);

// With Google Login I get a blank idTokenPayload ... Username-Password works great
_doAuthentication( authResult ) {
        this.lock.hide();
        this.setTokens(
            authResult.accessToken,
            authResult.idToken
        );

        if( authResult.idTokenPayload['http://myhost.com/'] ) {
        }
}

If been chasing this for over a month and cannot determine the reason … especially frustrating as it works on the TryIt page with Google Connection.

Anyone have any idea?

1 Like

Could you upload a .HAR file of your attempt to login via database connection and also with google connection? This will help us troubleshoot this properly. https://auth0.com/docs/troubleshoot/har

1 Like

Sorry for the delay … Will do

[Database and Google Hars](https://www.dropbox.com/sh/im40a58dsx4euqi/AAA5o6oAeuYXNIbNmR6XU01za?dl=0AAA5o6oAeuYXNIbNmR6XU01za?dl=0

Here you go! Thanks in advance

Found the Problem! While chasing a “Failed cross origin authentication” Consent Required problem on User-Password-Connection I found a link to Issue #1672. On a hunch that redirect was the issue I changed my auth configuration to redirect:true … and this resolves the issue!

Please note if you are using a Google Connection (and I suspect other social connections). You must set redirect:true.

Thanks!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.