取得 Google API 用戶端 ID
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Google 登入會管理 OAuth 2.0 流程和權杖生命週期,簡化與 Google API 的整合。使用者隨時可以撤銷應用程式的存取權。
如要在網站中整合 Google 第三方授權程式庫,您必須先建立用戶端 ID,才能呼叫第三方授權 API。
如要建立 Google Cloud 控制台專案和用戶端 ID,請按照操作說明取得 Google API 用戶端 ID。
設定專案時,請選取「網頁瀏覽器」用戶端類型,並指定應用程式的來源 URI。執行測試時,請將 http://localhost
和 http://localhost:<port_number>
新增至「已授權的 JavaScript 來源」欄位。
設定完成後,請記下建立的用戶端 ID。您需要用戶端 ID 才能完成後續步驟。(系統也會建立用戶端密鑰,但您只需要用於伺服器端作業)。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-06 (世界標準時間)。
[null,null,["上次更新時間: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.)"]]