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. Generate and Analyze HAR Files

1 Like

Sorry for the delay ā€¦ Will do

[Database and Google Hars](Dropbox - File Deleted

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.