Search code examples
google-apigoogle-oauthgoogle-signin

Google Sign-in Library OAuth Console Error - "The value of 'callback' is not a function. Configuration ignored."


I've been having quite a hard time trying to implement the new Google Sign-in library (https://developers.google.com/identity/oauth2/web/guides/overview) on a site, specifically via OAuth using the authorization code model.

I originally attempted to use their much easier Sign In with Google for Web option, but because they allow no design control over the button as it's injected via an iFrame, I decided to go the OAuth route.

The issue I need to figure it is why I'm getting the below console error:

[GSI_LOGGER]: The value of 'callback' is not a function. Configuration ignored.

I'm not a JS expert, but have a basic grasp and understanding of it, and don't really understand this as I'm literally using Google's own code for the callback function (which is an arrow function):

const g_signup_client = google.accounts.oauth2.initCodeClient({
        client_id: '...',
        scope: 'https://www.googleapis.com/auth/userinfo.profile',
        ux_mode: 'popup',
        callback: (response) => {
            ...
        }
    });

Despite this, clicking the button and selecting a Google account via the popup does execute the callback function...

Another odd thing is that the above code works just fine on a small demo page (makes implementation easier because I can have a clean slate to 'break things down').

Thanks.


Solution

  • It seems like this issue is no longer as the error hasn't shown in the console for a couple of weeks now. I guess it's possible that it stemmed from Google's side, or maybe Chrome's, I have no idea, but, at least I can sleep peacefully now.

    Just thought I'd come back and note this.