在“凭据”页面上,如果您还没有 Web 应用客户端 ID,请创建一个。您可以将“已获授权的 JavaScript 来源”和“已获授权的重定向 URI”字段留空。此客户端 ID 代表您的身份验证后端服务器。(您会在从服务器调用 Google API 时使用此客户端 ID,但即使您不调用 Google API,也需要此 ID。)
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Get started with One Tap sign-in and sign-up\n\n| **Caution:** One Tap for Android is deprecated. To ensure the continued security and usability of your app, [migrate to\n| Credential Manager](/identity/sign-in/credential-manager). Credential Manager supports passkey, password, and federated identity authentication (such as Sign-in with Google), stronger security, and a more consistent user experience.\n\nBefore you add One Tap sign-in to your app, set up your Google APIs and Android\nprojects.\n\nSet up your Google APIs console project\n---------------------------------------\n\n1. Open your project in the [API Console](https://console.cloud.google.com/), or create a project if you don't already have one.\n2. On the OAuth consent screen page, make sure all of the information is complete and accurate. In particular, make sure you have specified the URLs of your app's privacy policy and terms of service.\n3. On the Credentials page, create an Android client ID for your app if you don't already have one. You will need to specify your app's package name and SHA-1 signature.\n 1. Go to the [Credentials page](https://console.cloud.google.com/apis/credentials).\n 2. Click **Create credentials \\\u003e OAuth client ID**.\n 3. Select the **Android** application type.\n4. On the Credentials page, create a web application client ID if you don't already have one. You can leave the Authorized JavaScript Origins and Authorized redirect URIs fields blank. This client ID represents your authentication backend server. (You would use this client ID when calling Google APIs from your server, but you need it even if you don't.)\n 1. Go to the [Credentials page](https://console.cloud.google.com/apis/credentials).\n 2. Click **Create credentials \\\u003e OAuth client ID**.\n 3. Select the **Web application** application type.\n\nInclude dependencies in your Android project\n--------------------------------------------\n\n1. In your project-level `build.gradle` file, make sure to include Google's Maven repository (`google()`) in both your `buildscript` and `allprojects` sections.\n2. Add the dependencies for [Google Play services](https://developers.google.com/android)' authentication libraries\n to your module (app-level) build file (usually `app/build.gradle`):\n\n apply plugin: 'com.android.application'\n\n dependencies {\n // ...\n\n implementation 'com.google.android.gms:play-services-auth:21.3.0'\n }\n\nOptional: Associate your app with your site\n-------------------------------------------\n\nIf you have a web site that shares your app's sign-in backend,\n[create and publish a digital asset links file](https://developers.google.com/identity/smartlock-passwords/android/associate-apps-and-sites)\nso that users who sign in on one platform can easily sign in on the other.\n\nNext steps\n----------\n\n[Add One Tap sign-in flows to your app](/identity/legacy/one-tap/legacy-get-saved-credentials)."]]