Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user triggered gapi.auth.authorize callback is never triggered (Uncaught TypeError) #103

Closed
wonderfly opened this issue Jan 7, 2015 · 16 comments

Comments

@wonderfly
Copy link
Contributor

From jan.tova...@gmail.com on September 04, 2013 03:00:35

What steps will reproduce the problem?
I am able to reproduce this issue using slightly modified demo page (no plus api call at the end + debug to console):

<script type="text/javascript"> var clientId = "";
    var apiKey = "<?php echo GAPP_DEVELOPER_KEY; ?>";

    var scopes = " https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/userinfo.email"; function handleClientLoad() {
        // Step 2: Reference the API key
        gapi.client.setApiKey(apiKey);
        window.setTimeout(checkAuth,1);
    }

    function checkAuth() {
        gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: true}, handleAuthResult);
    }

    function handleAuthResult(authResult) {
        var authorizeButton = document.getElementById('authorize-button');
        console.log(authResult);
        if (authResult && !authResult.error) {
            authorizeButton.style.visibility = 'hidden';
            makeApiCall();
        } else {
            authorizeButton.style.visibility = '';
            authorizeButton.onclick = handleAuthClick;
        }
    }

    function handleAuthClick(event) {
        // Step 3: get authorization to use private data
        gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: false}, handleAuthResult);
        return false;
    }

    // Load the API and make an API call.  Display the results on the screen.
    function makeApiCall() {
        // Step 4: Load the Google+ API
        alert("asd");
    }
\</script>
// Step 1: Load JavaScript client library
\<script src=" https://apis.google.com/js/client.js?onload=handleClientLoad"></script> \</head>
Authorize What is the expected output? What do you see instead? After either granting or revoking permissions to my app, I am expecting 'handleAuthResult' function to be called. However, this callback function is never reached and Chrome displays an error message in console (see attached file) What version of the product are you using? On what operating system? Client version - it's obvious from test code I think. As stated above, I was using Chrome for testing. I tested it in Firefox, same problem (callback not fired but there was nothing in FF web console). Note: I am running it on my local webserver (Apache), not from file. Please provide any additional information below. In attached file, you can see two entries in console - first one is null. It is debug for callback for initial 'gapi.auth.authorize' call (with immediate: true). However, when user triggers 'gapi.auth.authorize' with button click (immediate:false), flow is as following: 1. Popup window with permissions authorization is shown 2. When user accept/deny, popup window is closed 3. instead of firing callback, TypeError appears in console (regardless of whether user authorized app to handle requested data or not)

It is important to note that yesterday everything was working, it got broken this morning when I tried to proceed with my further implementation. I don't think I have done anything wrong - popup window is normally shown, thus all my app credentials are correct.

Attachment: gapi-js-client-error.jpg

Original issue: http://code.google.com/p/google-api-javascript-client/issues/detail?id=103

@wonderfly
Copy link
Contributor Author

From alu...@alucab.org on September 04, 2013 08:04:30

I add these information

  1. with immediate:true the system works
  2. with immediate:false the token is obtained but the callback is not activated due to the error

I workarounded with a timer but it is really nasty, i have customers yelling as a lot of pages accessing to private spreadsheets are not working more

@wonderfly
Copy link
Contributor Author

From j...@google.com on September 04, 2013 08:45:58

Status: Accepted
Labels: -Priority-Medium Priority-Critical

@wonderfly
Copy link
Contributor Author

From j...@google.com on September 04, 2013 10:40:53

Issue 104 has been merged into this issue.

@wonderfly
Copy link
Contributor Author

From j...@google.com on September 04, 2013 12:15:47

Issue 105 has been merged into this issue.

@wonderfly
Copy link
Contributor Author

From j...@google.com on September 04, 2013 12:18:04

We have identified the cause and are working on a fix. We will let you know once it's pushed out. Thank you all very much for the detailed repro information.

@wonderfly
Copy link
Contributor Author

From hcdinot...@gmail.com on September 04, 2013 14:52:20

do we have any updates? My site is completely blocked now ...

@wonderfly
Copy link
Contributor Author

From j...@google.com on September 04, 2013 18:33:10

Issue 106 has been merged into this issue.

@wonderfly
Copy link
Contributor Author

From SamDzir...@gmail.com on September 04, 2013 21:12:04

I also just noticed the problem. It was working fine through Aug 31, 2013. I just tried today (Sep 5 2013) and noticed the problem. Was the API changed?

@wonderfly
Copy link
Contributor Author

From avolkho...@gmail.com on September 04, 2013 22:10:16

Having the same problem - it was working fine a few days back

@wonderfly
Copy link
Contributor Author

From jan.tova...@gmail.com on September 05, 2013 00:49:08

I just tested it - callbacks seem to be fired again, but I would rather wait for official confirmation that whole issue is fixed (but this is indicator that they are already working on it).

@wonderfly
Copy link
Contributor Author

From g...@asana.com on September 05, 2013 11:21:25

Any update on this? We have a workaround in place but it causes us other problems—we'd like to remove it as soon as we can be confident the issue is resolved, so if it's actually fixed it would be helpful to hear that confirmed.

@wonderfly
Copy link
Contributor Author

From j...@google.com on September 05, 2013 11:28:55

We are still rolling out. As #10 observed, some clients may be seeing the fix already. I will post an update once the global push is complete.

@wonderfly
Copy link
Contributor Author

From freeman...@gmail.com on September 05, 2013 12:02:26

It would be great to have a post-mortem added to this to explain why this
happened in the first place.

On Thu, Sep 5, 2013 at 11:29 AM, <
google-api-javascript-client@googlecode.com> wrote:

@wonderfly
Copy link
Contributor Author

From hcdinot...@gmail.com on September 05, 2013 21:12:23

I agree. wondering what the bug was and how it was fixed

On Thu, Sep 5, 2013 at 2:02 PM, <google-api-javascript-client@googlecode.com

@wonderfly
Copy link
Contributor Author

From j...@google.com on September 06, 2013 13:24:27

Hi everyone, the fix finished push at around 9/5/13 6pm PDT.

Status: Fixed

@wonderfly
Copy link
Contributor Author

From hcdinot...@gmail.com on September 06, 2013 13:31:55

Thanks! May I ask what the fix is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant