รับรหัสไคลเอ็นต์ของ Google API
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
การลงชื่อเข้าใช้ด้วย Google จะจัดการโฟลว์ OAuth 2.0 และวงจรโทเค็น ซึ่งช่วยลดความซับซ้อนในการผสานรวมกับ Google APIs ผู้ใช้มีตัวเลือกในการเพิกถอนสิทธิ์เข้าถึง
แอปพลิเคชันได้ทุกเมื่อ
ก่อนที่จะผสานรวมไลบรารีการให้สิทธิ์ของบุคคลที่สามของ Google เข้ากับเว็บไซต์ คุณต้องสร้างรหัสไคลเอ็นต์ ซึ่งคุณต้องใช้เพื่อเรียก API การให้สิทธิ์ของบุคคลที่สาม
หากต้องการสร้างโปรเจ็กต์และรหัสไคลเอ็นต์ของคอนโซล Google Cloud ให้ทำตามวิธีการรับรหัสไคลเอ็นต์ Google API
เมื่อกำหนดค่าโปรเจ็กต์ ให้เลือกประเภทไคลเอ็นต์ของเว็บเบราว์เซอร์และระบุ URI ต้นทางของแอป เมื่อทำการทดสอบ คุณต้องเพิ่มทั้ง http://localhost
และ http://localhost:<port_number>
ลงในช่องต้นทางของ JavaScript ที่ได้รับอนุญาต
หลังจากกำหนดค่าเสร็จแล้ว ให้จดรหัสไคลเอ็นต์ที่สร้างขึ้น
คุณจะต้องใช้รหัสไคลเอ็นต์เพื่อทำขั้นตอนถัดไปให้เสร็จสมบูรณ์ (ระบบจะสร้างรหัสลับไคลเอ็นต์ด้วย
แต่คุณจะใช้ได้เฉพาะสำหรับการดำเนินการฝั่งเซิร์ฟเวอร์)
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-06 UTC
[null,null,["อัปเดตล่าสุด 2025-08-06 UTC"],[[["\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.)"]]