Google-api-javascript-client: Auth - SignUp - Callback does not fire

Created on 11 Apr 2018  路  4Comments  路  Source: google/google-api-javascript-client

When i call the auth2.signIn() function i see the following result in my network tab:

GET https://accounts.google.com/o/oauth2/iframerpc?action=issueToken...
Status Code 200
{"error":"USER_LOGGED_OUT","detail":"No active session found."}

But the error Callback of my auth2.signIn(...) function is never called.
My Code should work because i get the popup_closed_by_user error callback.

Anyone knows how to solve the USER_LOGGED_OUT error?
And i guess the error callback should be called.

My code looks something like this...

...

    gapi.load('auth2', () => {
      console.log('load:auth2');
      this.initAuth2();
      this.initListeners();
    });
...

private initAuth2() {
    console.log('initAuth2');
    this.auth2 = gapi.auth2.init({
      client_id: '###',
      scope: 'profile'
    });
  }


public signIn(): Promise<any> {
     const options = new gapi.auth2.SigninOptionsBuilder();
        options.setPrompt('select_account');
        this.auth2.signIn(options).then((user) => {
          console.log(user);
          resolve(user);
        }, (err) => {
          console.log(err);
          reject(err);
        // });
      })
...

Most helpful comment

Hey.
After hours of debugging i was found the problem.

I recentrly installed ghostery browser plugin (blocks tracking and ad scripts)

Login Worked in all Browsers except for chrome (where ghostery was installed)

So somehow ghostery caused this "USER_LOGGED_OUT" error.

But anyway the error callback was never called for the error i mentioned above.
so i guess that should be fixed :)

All 4 comments

  1. in which browser you see this error? Does your code work on other browsers?
  2. "USER_LOGGED_OUT" means there is no active sessions in google.com. In this case, you should display the Google Sign In button, to allow end user to open a popup and log into google firstly.

Hey.
After hours of debugging i was found the problem.

I recentrly installed ghostery browser plugin (blocks tracking and ad scripts)

Login Worked in all Browsers except for chrome (where ghostery was installed)

So somehow ghostery caused this "USER_LOGGED_OUT" error.

But anyway the error callback was never called for the error i mentioned above.
so i guess that should be fixed :)

Good to know your problem has been resolved.

We already have another bug to track the callback issue: https://github.com/google/google-api-javascript-client/issues/385

Hey @kongguibin @dominikstrasser I'm having this issue with ghostery, is there a fix for it?

Was this page helpful?
0 / 5 - 0 ratings