You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Sites中Google Signin按钮点击弹出空白页,提示Origin不被允许

问题诊断与修复方案

1. 核心错误:Client-ID未授权当前站点域名

控制台提示[GSI_LOGGER]: The given origin is not allowed for the given client ID,说明你在Google Cloud配置的OAuth客户端ID,没有把当前Google Sites的域名加入已授权的JavaScript来源列表。

  • 登录Google Cloud控制台,找到对应项目的OAuth 2.0客户端ID配置页
  • 在「已授权的JavaScript来源」中添加你的站点完整域名(必须带https://,比如https://thembaheino.nl或你的Google Sites默认域名)
  • 同时检查「已授权的重定向URI」,确保data-login_uri指向的地址也在列表内

2. 修复重定向URI格式问题

你的代码里data-login_uri="thembaheino.nl/test"缺少协议头,Google身份服务要求重定向URI必须是完整绝对地址,修改为:

data-login_uri="https://thembaheino.nl/test"

3. Google Sites嵌入代码的正确方式

Google Sites对第三方脚本有加载限制,不能直接随意插入代码:

  • 使用Google Sites的「嵌入」组件,选择「嵌入代码」选项,把完整的HTML代码粘贴进去
  • 确认<script src="https://accounts.google.com/gsi/client" async defer></script>没有被站点安全策略拦截

修正后的完整代码

<script src="https://accounts.google.com/gsi/client" async defer></script>
<div id="g_id_onload"
     data-client_id="147904889152-dpkd99nltl33r9f2rprctsfu9u04m6qa.apps.googleusercontent.com"
     data-context="signup"
     data-ux_mode="redirect"
     data-login_uri="https://thembaheino.nl/test"
     data-auto_prompt="false">
</div>

<div class="g_id_signin"
     data-type="standard"
     data-shape="rectangular"
     data-theme="outline"
     data-text="signin_with"
     data-size="large"
     data-logo_alignment="left">
</div>

内容的提问来源于stack exchange,提问作者user2188317

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.25 13:33:30