简体   繁体   English

阻止第三方Cookie时,Google Signin成功功能不起作用

[英]Google Signin onsuccess function does nothing when I block 3rd party cookies

I am building AngularJS application that uses basic Google Signin process https://developers.google.com/identity/sign-in/web/ . 我正在构建使用基本Google登录过程https://developers.google.com/identity/sign-in/web/的 AngularJS应用程序。

Everything works fine, I can sign in as a google user except I have one issue when I disable third party cookies. 一切正常,我可以以Google用户身份登录,但禁用第三方Cookie时遇到一个问题。

When third party cookies are disabled on browser like this (Chrome) content settings google sign in process does nothing. 如果在此类(Chrome) 内容设置的浏览器上禁用了第三方Cookie,则Google登录过程将不执行任何操作。

More precisely I have a function that triggers on onsuccess event for google button but does nothing. 更确切地说,我有一个函数会在Google按钮的onsuccess事件上触发,但什么也不做。 Also I am not possible to catch an error so I can't workaround after this. 另外,我无法捕捉到错误,因此之后无法解决。

One thing that is happening also is that on loading google meta data when third-party cookies are disabled it raises an error 发生的一件事还在于,在禁用第三方Cookie的情况下加载Google元数据时,会引发错误

Uncaught SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document

It seems that google does everything fine like it should be on success but doesn't execute the code that is in that onsuccess function. 似乎google可以完成所有应有的工作,但不会执行onsuccess函数中的代码。

I tried everything and even on google developers site on Integrate Sign-in page when I click on sample sign in button it happens the same: 当我单击示例登录按钮时,我尝试了所有操作,甚至在“集成登录”页面上的google开发人员网站上也是如此:

  • If I enable cookies it returns to me "signed in as: MyName" 如果启用cookie,它将返回给我“登录为:MyName”
  • If I disable cookies it returns nothing to me 如果我禁用Cookie,则不会返回任何内容

The overall question is, is there a way to catch this error and work around this and not having google executes everything like it is ok and doesn't execute code that is in onsuccess function? 总体问题是,是否有办法捕获此错误并解决此问题,而不让google执行一切正常且不执行onsuccess函数中的代码?

Users who have third party cookies disabled cannot access pop-up Google sign-in . 禁用了第三方Cookie的用户无法访问弹出式Google登录

This is a deal breaker for us, as third party cookies are a recommended privacy practice (and the default in Safari). 这对我们来说是一个大难题,因为建议使用第三方Cookie(这是Safari中的默认做法),这是隐私保护的一种做法。 Instead it's necessary to use the Google API to generate an authentication URL , after which you'll get a callback with a token. 相反,必须使用Google API 生成身份验证URL ,之后您将获得带有令牌的回调。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM