指南

Google 登入(平台統一)

Google 登入(平台統一)

HSystem 的 Google OAuth 只使用平臺統一的 Google 憑證(Worker GOOGLE_* secrets)。因此:

  • 開發者不需要、也不應該去 Google Cloud Console 建立自己的 Client
  • App 端只需在 Auth 設定「啟用 Google 登入」即可(沒有 Client ID/Secret 表單)

bind-first(先綁定才可用)

Google 登入採用 bind-first:使用者必須先在 HSystem 把 Google 綁定到既有帳號,才允許用 Google 登入您的 App。

  • 綁定入口:/account(需先登入)→ 社交綁定 → Google
  • 若尚未綁定就嘗試 Google 登入:會得到 google_oauth_not_bound,並導回登入/提示綁定

實際端點(通常不需要手動呼叫)

託管登入頁的「使用 Google 登入」會走以下端點(僅供理解流程):

  • GET {{api_base}}/oauth/google/start
  • GET {{api_base}}/oauth/google/callback(Google Console redirect URI 也會落在此路徑)

原生 App 另見 [原生 App OAuth(Google)](./19-native-oauth.md)POST /oauth/google/exchangePOST /oauth/google/resume

> 若平臺未配置 Google(未設 secrets),則託管頁不會顯示 Google,且相關端點會回 google_oauth_not_configured

目前為模擬模式,回應為範例資料

登入 Dev 以真實測試

體驗託管登入頁

模擬預覽:下方為終端用戶在 OAuth 流程中看到的 HSystem 託管登入畫面。

https://auth.hsystem.halphastech.com/hosted/login
無法載入登入預覽,請確認 App 已啟用 Auth。
模擬預覽

登入 Dev 並從 App 頁面帶入 ?app= 即可切換為可互動的真實 OAuth 流程。