获取您的 Google API 客户端 ID
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Google 登录可管理 OAuth 2.0 流程和令牌生命周期,从而简化您与 Google API 的集成。用户始终可以选择随时撤消对应用的访问权限。
在将 Google 第三方授权库集成到您的网站中之前,您必须先创建一个客户端 ID,以便调用第三方授权 API。
如需创建 Google Cloud 控制台项目和客户端 ID,请按照获取 Google API 客户端 ID 的说明操作。
配置项目时,选择 Web 浏览器客户端类型并指定应用的来源 URI。执行测试时,必须将 http://localhost
和 http://localhost:<port_number>
添加到“已获授权的 JavaScript 来源”字段。
配置完成后,记下所创建的客户端 ID。您将需要使用该客户端 ID 来完成后续步骤。(系统还会创建客户端密钥,但您只需在服务器端操作中使用该密钥。)
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-06。
[null,null,["最后更新时间 (UTC):2025-08-06。"],[[["\u003cp\u003eGoogle Sign-In streamlines the use of Google APIs by managing the OAuth 2.0 flow and token lifecycle, allowing users to revoke access at any time.\u003c/p\u003e\n"],["\u003cp\u003eBefore integrating Google 3P Authorization, you need to create a client ID within a Google API Console project, specifying the Web browser client type and authorized origins including localhost for testing.\u003c/p\u003e\n"],["\u003cp\u003eAfter project configuration, note the generated client ID, which is essential for subsequent integration steps.\u003c/p\u003e\n"]]],[],null,["# Get your Google API client ID\n\nGoogle Sign-In manages the OAuth 2.0 flow and token lifecycle, simplifying your\nintegration with Google APIs. A user always has the option to [revoke access](https://myaccount.google.com/permissions)\nto an application at any time.\n\nBefore you can integrate Google 3P Authorization library into your website, you\nmust create a client ID, which you need to call the 3P Authorization API.\n\nTo create a Google Cloud console Project and Client ID, follow the\n[instructions to get your Google API client ID](https://developers.google.com/identity/gsi/web/guides/get-google-api-clientid#get_your_google_api_client_id).\n\nWhen you configure the project, select the Web browser client type and specify\nthe origin URI of your app. When you perform tests, both `http://localhost` and\n`http://localhost:\u003cport_number\u003e` must be added to the Authorized JavaScript\norigins field.\n\nAfter configuration is complete, take note of the client ID that was created.\nYou will need the client ID to complete the next steps. (A client secret is also\ncreated, but you need it only for server-side operations.)"]]