Java 8 已停止支援,並將於 2026 年 1 月 31 日
淘汰。淘汰後,您將無法部署 Java 8 應用程式,即使貴機構先前使用機構政策重新啟用舊版執行階段的部署作業也一樣。現有的 Java 8 應用程式在
淘汰日期後,仍會繼續執行並接收流量。建議您
改用最新支援的 Java 版本。
驗證使用者
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
如要在應用程式中驗證使用者,Google 提供下列方法: Google Cloud
驗證服務 |
目的 |
Firebase 驗證 |
提供多種使用者驗證選項,包括透過 Google、Facebook 和 Twitter 進行驗證。這種方法可支援最多使用者,同時使用最少量的程式碼。 |
Google 登入 |
Google 登入可讓您登入 Gmail 和 Google Workspace 帳戶,並支援一次性密碼 (OTP)。如果只是要支援 Google 帳戶,或是在現有登入系統中支援 Google 帳戶,那麼這是最簡單的方法。 |
OAuth 2.0 和 OpenID Connect |
OpenID Connect 可讓您從頭開始處理及使用驗證代碼,且提供最多自訂空間。 |
Google Cloud Identity Platform |
Identity Platform 是客戶身分與存取權管理 (CIAM) 平台,可協助機構將身分與存取權管理功能導入應用程式。如果使用者想自行提供身分識別服務,這個選項就很適合。 |
Users API
|
Users API 是用於驗證 Google 和 Google Workspace 帳戶的傳統套裝服務之一。這個內建 API 僅適用於 App Engine。 |
Identity-Aware Proxy (IAP)
|
透過 IAP,您可以在要求抵達應用程式資源之前,控管 App Engine 服務的存取權。IAP 可讓您為應用程式建立集中式授權層,並搭配簽署標頭或 App Engine Users API 來保護應用程式。與本表中的其他驗證服務不同,IAP 會在您可以存取應用程式之前執行驗證。本頁面上的其他選項,在應用程式中實作驗證。 |
Firebase 驗證
Firebase 驗證提供設計完善、安全無虞且能夠獨立運作的驗證系統,便於您讓使用者選擇想用的帳戶登入。Firebase 驗證除了支援 Google、Facebook、Twitter 和其他服務的聯合登入機制外,還支援密碼驗證,讓您在電腦和行動裝置上輕鬆擴充驗證系統。
如要為 Google App Engine 應用程式設定使用者驗證,Firebase 驗證是最簡單的方法。您可以參考下列資源,進一步瞭解 Firebase 驗證:
Google 登入
如果您想在網站或應用程式中提供 Google 登入按鈕,或是您在網域中使用 Google 管理控制台,且想根據該登入資訊來驗證使用者,則可使用 Google 登入。Google 登入是我們使用 OAuth 2.0 和 OpenID Connect 通訊協定打造的登入用戶端程式庫。
Google 登入適用於網頁應用程式、iOS 和 Android。
OAuth 2.0 和 OpenID Connect
Google 登入是根據 Google 的 OAuth 2.0 實作方式所建構,符合 OpenID Connect 規格,且已通過 OpenID 認證。
OpenID Connect 是以 OAuth 2.0 通訊協定為基礎的識別層級,應用程式可用來擷取使用者個人資料資訊。
Identity Platform 提供可自訂的置入式身分和驗證服務,能用於使用者的註冊及登入程序。Identity Platform 支援多種驗證方法 (SAML、OIDC、電子郵件/密碼、社交媒體、手機和其他自訂驗證方法),能夠為各種身分解決方案提供靈活的整合選項。Identity Platform 奠基於Google Cloud的全球規模、效能、網路和安全性,同時提供企業級支援服務與服務水準協議,能滿足幾乎所有應用程式或服務的需求。
Identity Platform 提供自己的使用者身分系統。如果您已為網域使用 Google Workspace,且想根據該登入資訊驗證使用者,應使用 Google 登入。
如要瞭解如何將 Identity Platform 與 App Engine 整合,請參閱在 App Engine 中登入使用者的操作說明指南。
Users API
Users API 可讓應用程式執行下列工作:
- 偵測目前的使用者是否已登入。
- 將使用者重新導向至適當的登入頁面以進行登入。
- 如果使用者沒有 Google 帳戶,則要求使用者建立新帳戶。
使用者登入應用程式後,應用程式便可存取該使用者的電子郵件地址,還可偵測目前的使用者是否為管理員,方便您實作應用程式的管理員專屬區域。
詳情請參閱 Users API 總覽頁面。
Identity-Aware Proxy (IAP)
IAP 會在資源前端為外部入站要求新增驗證和授權層,以保護應用程式並確保其安全。IAP 無法保護專案內的活動,例如同一個專案中的其他 App Engine 服務。未獲授權存取應用程式的使用者,將無法存取您的 App Engine 應用程式。
只有具備正確身分與存取權管理 (IAM) 角色的實體,才能存取受 IAP 保護的服務或應用程式。當使用者嘗試存取 IAP 保護的資源時,IAP 會為您執行驗證和授權檢查。如要瞭解 IAP 如何保護應用程式資源,請參閱 IAP 總覽。
您可以為整個應用程式啟用 IAP,也可以為特定服務或應用程式版本啟用 IAP。請參閱 IAP 快速入門,瞭解如何為 App Engine 資源設定 IAP。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-09-04 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eGoogle Cloud offers multiple authentication methods for applications, including Firebase Authentication, Google Sign-In, OAuth 2.0 and OpenID Connect, Google Cloud Identity Platform, Users API, and Identity-Aware Proxy (IAP).\u003c/p\u003e\n"],["\u003cp\u003eFirebase Authentication provides a comprehensive system for user sign-in with various identity providers, making it the simplest option for Google App Engine apps.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Sign-In is the recommended method for authenticating users with Google accounts or when integrating with Google Workspace.\u003c/p\u003e\n"],["\u003cp\u003eOAuth 2.0 and OpenID Connect allow for highly customized authentication token handling and provide access to user profile information.\u003c/p\u003e\n"],["\u003cp\u003eIdentity-Aware Proxy (IAP) adds a centralized authentication layer to secure App Engine resources, by verifying access before requests reach the application.\u003c/p\u003e\n"]]],[],null,["# Authenticating Users\n\nTo authenticate users in Google Cloud applications, Google offers the following\nmethods:\n\nFirebase Authentication\n-----------------------\n\n[Firebase Authentication](https://firebase.google.com/docs/auth/) gives you a\nrobust, secure authentication system-in-a-box that helps you do sign in with any\naccount your users want to use. Firebase Authentication supports password\nauthentication in addition to federated sign-in with Google, Facebook, Twitter,\nand more, allowing you to easily scale your authentication system as you grow on\ndesktop and mobile.\n\nFirebase Authentication is the easiest way to set up user authentication for a\nGoogle App Engine app. To learn more about Firebase Authentication, try the\nfollowing:\n\n- [Firebase Web Tutorial](https://codelabs.developers.google.com/codelabs/firebase-web/)\n highlights how to use Firebase on a website, including user sign-in with Google\n as the Identity Provider.\n\n- [Firebase Quickstart Apps](https://firebase.google.com/docs/samples/) show\n how to integrate Firebase across platforms, using both federated sign-in and\n username/password sign-in examples. Samples demonstrate Firebase Authentication\n using the [JavaScript SDK](https://github.com/firebase/quickstart-js/tree/master/auth)\n as well as on [iOS](https://github.com/firebase/quickstart-ios/tree/master/authentication)\n and [Android](https://github.com/firebase/quickstart-android/tree/master/auth).\n\nGoogle Sign-In\n--------------\n\nIf you want to provide a Google login button for your website or app, or you're\nusing Google Admin console for your domain and you want to authenticate users based\non that login, you can use [Google Sign-in](https://developers.google.com/identity/),\nwhich is our sign-in client library built on the OAuth 2.0 and OpenID Connect\nprotocols.\n\nGoogle Sign-In is available for\n[Web Apps](https://developers.google.com/identity/gsi/web/guides/overview),\n[iOS](https://developers.google.com/identity/sign-in/ios/),\nand [Android](https://developers.google.com/identity/sign-in/android/).\n\nOAuth 2.0 and OpenID Connect\n----------------------------\n\nGoogle Sign-in is based on Google's OAuth 2.0 implementation,\nwhich conforms to the [OpenID Connect specification](http://openid.net/connect/),\nand is [OpenID Certified](http://openid.net/certification/).\n\nOpenID Connect is an identity layer on top of the OAuth 2.0 protocol, and your\napp can use it to [retrieve user profile information](https://developers.google.com/identity/protocols/OpenIDConnect#obtaininguserprofileinformation).\n\nIdentity Platform\n-----------------\n\n[Identity Platform](https://cloud.google.com/identity-platform) provides a drop-in,\ncustomizable identity and authentication service for user sign-up and sign-in.\nIdentity Platform supports multiple authentication methods (SAML, OIDC,\nemail/password, social, phone, and custom auth) to provide flexible integration\noptions for any identity solution. Identity Platform is built on\nGoogle Cloud's global scale, performance, network, and security, and comes with\nan enterprise-grade support and SLA to meet the demands of virtually any app or\nservice.\n\nIdentity Platform offers its own user identity system. If you're already using\nGoogle Workspace for your domain and want to authenticate users based on that\nlogin, you should use [Google Sign-In](#google_sign-in).\n\nTo learn about integrating Identity Platform with App Engine, try the\nhow-to guide for [signing in users on\nApp Engine](https://cloud.google.com/identity-platform/docs/web/app-engine).\n\nUsers API\n---------\n\nThe Users API allows an application to perform the following tasks:\n\n- Detect whether the current user is signed in.\n- Redirect the user to the appropriate sign-in page to sign in.\n- Request the user create a new Google account if they don't have one already.\n\nWhile a user is signed in to the application, the app can access the user's\nemail address. The app can also detect whether the current user is an\nadministrator, making it easy to implement admin-only areas of the app.\n\nMore information is available on the [Users API overview](../users).\n\nIdentity-Aware Proxy (IAP)\n--------------------------\n\nIAP protects and secures your application by adding an\nauthentication and authorization layer in front of your resources, for\ninbound external requests. IAP doesn't protect against activity\nwithin a project, such as another App Engine service inside the same\nproject. Users who are not authorized access to your app can't have access to\nreach your App Engine app.\n\nIAP-protected services or applications, can only be accessed by [principals](/iam/docs/overview#concepts_related_identity)\nwhich have the correct [Identity and Access Management (IAM) role](/iam/docs/understanding-roles).\nWhen a user tries to access an IAP-secured resource, IAP\nperforms authentication and authorization checks for you. Learn how\nIAP secures your application resources on the [IAP overview](/iap/docs/concepts-overview).\n\nYou can enable IAP for your whole app, or for specific services\nor versions of your app. See the [IAP quickstart](/iap/docs/authenticate-users-google-accounts)\nto learn how to configure IAP for your App Engine\nresources."]]