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

Google Sign In按钮报错:Parameter client_id is not set correctly 求助

Google Sign In按钮提示client_id设置错误的解决办法
  • 核对client_id的正确性
    必须使用Google Cloud控制台创建的Web应用类型OAuth 2.0客户端ID,别混淆Android、iOS这类其他平台的ID。还要仔细检查有没有复制错误,多空格、少字符都会导致问题。

  • 确认client_id的传递格式
    若通过HTML标签传参,要保证data-client_id属性拼写正确(是下划线分隔,不是驼峰式的data-clientId),正确写法示例:

    <div id="g_id_onload"
         data-client_id="你的有效client_id"
         data-callback="handleCredentialResponse">
    </div>
    <div class="g_id_signin"
         data-type="standard"
         data-size="large">
    </div>
    

    若通过JavaScript初始化,要在google.accounts.id.initialize方法里正确传入client_id参数:

    google.accounts.id.initialize({
      client_id: "你的有效client_id",
      callback: handleCredentialResponse
    });
    google.accounts.id.renderButton(
      document.getElementById("signInBtn"),
      { theme: "outline", size: "large" }
    );
    
  • 排查多client_id冲突问题
    如果页面同时加载了旧版Google Sign In和新版GSI的脚本,很可能出现参数冲突,建议只保留新版GSI的代码,删除旧的冗余脚本和配置。

  • 检查授权域名是否匹配
    登录Google Cloud控制台的OAuth客户端设置页面,确认当前网页的域名已经添加到“已授权的JavaScript来源”列表中,否则即使client_id正确,也会触发参数错误提示。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.07 17:55:18