開始使用 One Tap 登入及註冊
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
在應用程式中設定 One Tap 登入功能之前,請先設定 Google API 和 Android 專案。
設定 Google API 主控台專案
- 在 API 控制台中開啟專案;如果您尚未建立專案,請先建立專案。
- 在 OAuth 同意畫面頁面上,確認所有資訊皆完整且正確。具體來說,請確認您已指定應用程式隱私權政策的網址及服務條款。
- 在「憑證」頁面上,若還沒有 Android 用戶端 ID,請先為應用程式建立。您必須指定應用程式的套件名稱和 SHA-1 簽名。
- 在「憑證」頁面上,如果您還沒有網路應用程式用戶端 ID,請先建立。您可以將「授權 JavaScript 來源」和「授權的重新導向 URI」欄位留空。此用戶端 ID 代表您的驗證後端伺服器。(從伺服器呼叫 Google API 時,您將使用這個用戶端 ID,但就算您沒有這樣做,也需要用到這個 ID)。
在 Android 專案中加入依附元件
- 在專案層級的
build.gradle
檔案中,請務必在您的 buildscript
和 allprojects
區段中加入 Google 的 Maven 存放區 (google()
)。
將 Google Play 服務驗證程式庫的依附元件新增至模組 (應用程式層級) 建構檔案 (通常是 app/build.gradle
):
apply plugin: 'com.android.application'
dependencies {
// ...
implementation 'com.google.android.gms:play-services-auth:20.4.1'
}
選擇性:為應用程式和網站建立關聯
如果您擁有可分享應用程式登入後端的網站,請建立及發布數位資產連結檔案,讓使用者可在其中一個平台上輕鬆登入。
後續步驟
在應用程式中新增 One Tap 登入流程。
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-01-25 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"缺少我需要的資訊"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"過於複雜/步驟過多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"過時"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻譯問題"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/程式碼問題"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"容易理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"確實解決了我的問題"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]