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

authSample.html throws SecurityError #246

Closed
carlospalol opened this issue Oct 23, 2016 · 4 comments
Closed

authSample.html throws SecurityError #246

carlospalol opened this issue Oct 23, 2016 · 4 comments

Comments

@carlospalol
Copy link

1949109082-idpiframe.js:6 Uncaught SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.

  • OS X 10.11.6
  • Chrome 53.0.2785.143 (64-bit)
    • Allow local data to be set
    • Block third-party cookies and site data
  • Serving on http://localhost:5000/authSample.html
  • apiKey and clientId set OK

Seems related to googlesamples/google-services#190

@santihbc
Copy link

santihbc commented Nov 6, 2016

Seeing the same problem using both authentication with the idToken as well as authorization with the authorization code:

gapi.auth2.getAuthInstance()
    .grantOfflineAccess({ redirect_uri: "postmessage" })
    .then(({ code }) => code)
gapi.auth2.getAuthInstance()
    .signIn({ prompt: "select_account" })
    .then((googleUser) => {
        const idToken = googleUser.getAuthResponse().id_token;
        if (!idToken) {
        throw new Error("Authentication failed.");
    }
    return idToken;
    });

The callback (then) is never fired. When implementing this with sign in listeners, the same problem happens.

The error I see in the console is:

1949109082-idpiframe.js:6 Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.(…)

@bochunz
Copy link
Collaborator

bochunz commented Nov 6, 2016

@santihbc Could you mention what browser version are you using when you see this problem?

I'm able to get idToken by
gapi.auth2.getAuthInstance().currentUser.get().getAuthResponse().id_token

@bsittler
Copy link
Contributor

bsittler commented Nov 6, 2016

gapi.auth2 requires third-party cookies to be allowed

On Sun, Nov 6, 2016, 11:22 bochunz notifications@github.com wrote:

santihbc@ Could you mention what browser version are you using when you
see this problem?

I'm able to get idToken by
gapi.auth2.getAuthInstance().currentUser.get().getAuthResponse().id_token


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#246 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAD3R7W-_jSrutFcPVANR1j2-S_gkKISks5q7ijbgaJpZM4KeLtr
.

@TMSCH
Copy link
Contributor

TMSCH commented Feb 16, 2017

Duplicate of #260. Closing this one.

@TMSCH TMSCH closed this as completed Feb 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants