[null,null,["最后更新时间 (UTC):2025-03-10。"],[[["\u003cp\u003eThe FIDO2 API enables Android apps to utilize strong, attested public key-based credentials for user authentication, supporting BLE, NFC, USB roaming authenticators, and platform authenticators like fingerprint or screen lock.\u003c/p\u003e\n"],["\u003cp\u003eIt facilitates user registration (associating an authenticator with an account) and signing (authenticating a user) through the Fido2ApiClient.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can leverage Digital Asset Links to allow users to seamlessly share credentials between their website and Android application.\u003c/p\u003e\n"],["\u003cp\u003eEstablishing this interoperability involves hosting an assetlinks.json file on the website, linking to it in the app's manifest, and adding an asset_statements string resource to the strings.xml file.\u003c/p\u003e\n"]]],[],null,["# FIDO2 API for Android\n\nThe FIDO2 API allows Android applications to create and use strong, attested\npublic key- based credentials for the purpose of authenticating users. The API\nprovides a [WebAuthn Client](https://www.w3.org/TR/webauthn/#webauthn-client)\nimplementation, which supports the use of BLE, NFC, and USB roaming\nauthenticators (security keys) as well as a platform authenticator, which allows\nthe user to authenticate using their fingerprint or screen lock.\n| **Note:** If your app requires passkeys, you should use [Credential Manager](/identity/android-credential-manager) instead.\n\nIntegration\n-----------\n\nThe [FIDO2 API](https://developers.google.com/android/reference/com/google/android/gms/fido/fido2/package-summary)\nentry point is the [Fido2ApiClient](https://developers.google.com/android/reference/com/google/android/gms/fido/fido2/Fido2ApiClient).\n\nThe API supports two operations:\n\n- [Registration](/android/reference/com/google/android/gms/fido/fido2/Fido2ApiClient#getRegisterIntent(com.google.android.gms.fido.fido2.api.common.MakeCredentialOptions)) is done once per authenticator per account, when the user associates an authenticator with an account.\n- [Signing](/android/reference/com/google/android/gms/fido/fido2/Fido2ApiClient#getSignIntent(com.google.android.gms.fido.fido2.api.common.PublicKeyCredentialRequestOptions)) is done whenever the relying party wants to authenticate a user.\n\nBoth registration and signing require user interaction.\n\nInteroperability with your website\n----------------------------------\n\nIt is simple to allow users to seamlessly share credentials across your website\nand Android application. To do so, leverage [the Digital Asset Links](https://digitalassetlinks.org).\nYou can declare associations by hosting a Digital Asset Links JSON file on your\nwebsite, and adding a link to the Digital Asset Link file to your app's manifest.\n\nFor example, if you want to associate `https://example.com` with an Android app\n`com.example.android`, here's 3 required steps:\n\n### Step 1. Host `assetlinks.json` at your domain\n\nCreate a JSON file like this and host it at `https://example.com/.well-known/assetlinks.json`. \n\n [\n {\n \"relation\" : [\n \"delegate_permission/common.handle_all_urls\",\n \"delegate_permission/common.get_login_creds\"\n ],\n \"target\" : {\n \"namespace\" : \"web\",\n \"site\" : \"https://example.com\"\n }\n },\n {\n \"relation\" : [\n \"delegate_permission/common.handle_all_urls\",\n \"delegate_permission/common.get_login_creds\"\n ],\n \"target\" : {\n \"namespace\" : \"android_app\",\n \"package_name\" : \"com.example.android\",\n \"sha256_cert_fingerprints\" : [\n \"DE:AD:BE:EF\"\n ]\n }\n }\n ]\n\nMake sure it's crawlable from Google and is served with HTTP header\n`Content-Type: application/json`.\n\n`sha256_cert_fingerprints` is the SHA256 fingerprints of your app's signing certificate.\nFind more details in the [Android App Links documentation](https://developer.android.com/training/app-links/verify-site-associations#web-assoc).\n| **Note:** The `relation` will eventually only require `\"delegate_permission/common.get_login_creds\"` in order to share credentials between websites and apps, however, until we complete migrating our logic to accept it, please include both `\"delegate_permission/common.handle_all_urls\"` and `\"delegate_permission/common.get_login_creds\"`.\n\n### Step 2. Link to `assetlinks.json` in Android app\n\nIn your Android app, add the following line to the manifest file under `\u003capplication\u003e`: \n\n \u003cmeta-data android:name=\"asset_statements\" android:resource=\"@string/asset_statements\" /\u003e\n\n### Step 3. Add an `asset_statements` string resource to the strings.xml file\n\nThe `asset_statements` string is a JSON object that specifies the `assetlinks.json`\nfiles to load. You must escape any apostrophes and quotation marks you use in\nthe string. For example: \n\n \u003cstring name=\"asset_statements\" translatable=\"false\"\u003e\n [{\n \\\"include\\\": \\\"https://example.com/.well-known/assetlinks.json\\\"\n }]\n \u003c/string\u003e\n\nTo learn more about associating your app and your website, read the [SmartLock\nfor Passwords on Android documentation](/identity/smartlock-passwords/android/associate-apps-and-sites)."]]