Nhận mã ứng dụng khách Google API
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tính năng Đăng nhập bằng Google quản lý quy trình OAuth 2.0 và vòng đời mã thông báo, giúp đơn giản hoá quá trình tích hợp với API của Google. Người dùng luôn có thể thu hồi quyền truy cập vào một ứng dụng bất cứ lúc nào.
Để có thể tích hợp thư viện Uỷ quyền bên thứ ba của Google vào trang web, bạn phải tạo một mã nhận dạng ứng dụng khách. Bạn cần mã nhận dạng này để gọi API Uỷ quyền bên thứ ba.
Để tạo một Dự án và Mã ứng dụng khách trên Google Cloud Console, hãy làm theo hướng dẫn để lấy mã ứng dụng khách API của Google.
Khi bạn định cấu hình dự án, hãy chọn loại ứng dụng Web và chỉ định URI nguồn của ứng dụng. Khi bạn thực hiện kiểm thử, cả http://localhost
và http://localhost:<port_number>
đều phải được thêm vào trường Nguồn gốc JavaScript được uỷ quyền.
Sau khi hoàn tất cấu hình, hãy ghi lại mã ứng dụng khách đã được tạo.
Bạn sẽ cần mã nhận dạng khách hàng để hoàn tất các bước tiếp theo. (Khoá bí mật ứng dụng cũng được tạo, nhưng bạn chỉ cần khoá này cho các hoạt động phía máy chủ.)
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-06 UTC.
[null,null,["Cập nhật lần gần đây nhất: 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.)"]]