1

I include the Google Sign-in button on my page, and use gapi to interact with it. When the user successfully authenticates using the Google API , I make an AJAX call using JQuery to my server:

var token = gapi.auth.getToken();
var data = {
    "token": token,
    "userId": googleResponse.id
};
console.log("sending data");
console.log(data);
$.post(url, data, function(response) {
                window.location.reload();
            }, "json").error(function(responseObj, statusCode) {
                var response = responseObj.responseJSON;
                console.log("error");
                console.log(response);
                console.log(statusCode);
            });

I see this issue in the console:

"sending data"

Object { token: Object, userId: "xxxxxxxxxxxxxxx" }

Error: Permission denied to access property 'nodeType'

The page does not reload and I do not see additional info in the console.

I do not use JQuery to access any element properties or manipulate the DOM in any way.

This issue happens with Firefox 36.0.1 and JQuery 2.1.1, but not with Chrome or Safari (same page, same code), on my Mac.

EDIT There were posts suggesting FireBug is to blame, so I disabled it and restarted Firefox, but it didn't help.

1 Answer 1

6

I figured this out by taking a closer look at the token object I was sending: the token object contains a field called g-oauth-window, which contains a reference to the DOM object which created it. When you pass this token inside of a $.post request, JQuery will resolve this field, and it makes Firefox bug out. Blanking out this field (setting it to null) makes everything work!

1
  • can you be more precise and maybe add a code example or a link? Jul 6, 2022 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.