Google ClientID适用于Google Sign-in平台库,但不适用于新的GIS库。

huangapple go评论57阅读模式
英文:

Google ClientID works for Google Sign-in platform library but not new GIS library

问题

我正在尝试将我的应用程序从较旧的Google Sign-In平台库迁移到较新的Google Identity Services库。

我有一个在旧方法中有效的客户端ID,但是当我使用GIS加载“Google Sign-in”按钮时,我遇到403错误和错误日志,GSI_Logger表示我的来源未被允许与客户端ID一起使用。我在本地主机上,但当我使用旧方法时,本地主机没有任何问题。

唯一我能想到的不同之处是,我将我的Google客户端ID加载为常量,并在我的Vue应用程序的Login.vuemounted()部分中呈现按钮,而以前我在main.js中加载它。

英文:

I'm trying to migrate my application from the older Google Sign-In platform library to the newer Google Identity Services library.

I have a client ID that works for the old method, but when I load the "Google Sign-in" button using GIS, I get 403 errors and an error log that GSI_Logger says my origin is not allowed for the client ID. I'm on localhost, but when I use the old method, there are no issues with localhost.

The only thing I can think of being different is that I load my Google client ID as a constant and rendered the button in the mounted() section of my Vue app's Login.vue, while previously I loaded it in main.js.

答案1

得分: 2

"Google One Tap 只能显示在 HTTPS 域上"。

所以,它不起作用,因为 localhost 是 HTTP。我部署到我的测试环境,它是 HTTPS,没有出现 403 错误。

来源:https://developers.google.com/identity/gsi/web/guides/get-google-api-clientid

英文:

"Google One Tap can only be displayed in HTTPS domains".

So, it doesn't work because localhost is HTTP. I deployed to my testing environment which is HTTPS and got no such 403 errors.

Source: https://developers.google.com/identity/gsi/web/guides/get-google-api-clientid

huangapple
  • 本文由 发表于 2023年2月9日 03:16:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75390702.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定