英文:
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.vue
的mounted()
部分中呈现按钮,而以前我在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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论