Để tạo và xác thực bằng khoá truy cập, bạn sẽ sử dụng API WebAuthn cho web hoặc API Trình quản lý thông tin xác thực đối với ứng dụng Android. Các API này xử lý hoạt động giao tiếp giữa ứng dụng và trình cung cấp khoá truy cập.
Mặc dù các API này được gọi qua một ứng dụng, chẳng hạn như trang web hoặc ứng dụng Android, nhưng bạn vẫn cần triển khai các chức năng còn lại trên máy chủ để hoàn tất các trường hợp sử dụng xác thực.
Quá trình triển khai khoá truy cập bao gồm 2 chức năng:
Đăng ký khoá truy cập. Sử dụng API WebAuthn hoặc API Trình quản lý thông tin xác thực để cho phép người dùng tạo khoá truy cập. Lưu trữ khoá công khai liên kết trên máy chủ.
Xác thực bằng khoá truy cập. Nhận yêu cầu xác thực từ máy chủ rồi dùng API WebAuthn hoặc API Trình quản lý thông tin xác thực để cho phép người dùng ký thử thách này bằng khoá truy cập của họ. Xác minh chữ ký trên máy chủ. Nếu chữ ký hợp lệ, hãy xác thực người dùng.
Thư viện phía máy chủ
Mặc dù có thể triển khai chức năng khoá truy cập phía máy chủ từ đầu, nhưng bạn nên dùng thư viện.
Máy chủ hỗ trợ việc tạo và xác thực khoá truy cập được gọi là máy chủ FIDO2 hoặc viết tắt là máy chủ FIDO. Ở đây, chúng ta sẽ tham chiếu đến các thư viện phía máy chủ có triển khai tính năng hỗ trợ khoá truy cập dưới dạng thư viện phía máy chủ FIDO.
Tại sao nên sử dụng thư viện?
Việc sử dụng thư viện phía máy chủ FIDO có một số ưu điểm:
Thời gian và trải nghiệm của nhà phát triển.Quy cách WebAuthn rất phức tạp. Thư viện phía máy chủ FIDO có thể cung cấp các API đơn giản để triển khai khoá truy cập, giúp bạn tiết kiệm thời gian và tài nguyên phát triển.
Khả năng bảo trì.Thông số kỹ thuật WebAuthn có thể thay đổi. Việc sử dụng phiên bản mới nhất của một thư viện được duy trì liên tục giúp đảm bảo quá trình triển khai của bạn luôn được cập nhật.
Bảo mật và tuân thủ. Bạn muốn phương thức triển khai khoá truy cập của mình tuân thủ quy cách của WebAuthn và các yêu cầu về bảo mật của khoá truy cập đó. Thư viện phía máy chủ FIDO có thể giúp bạn đảm bảo quá trình triển khai diễn ra an toàn và tuân thủ quy cách. Tuỳ thuộc vào sản phẩm và ngành của bạn, việc triển khai cũng có thể phải tuân thủ các quy định yêu cầu bạn phải sử dụng một số tiêu chuẩn bảo mật cụ thể để xác thực.
Nếu có thể, hãy cân nhắc việc hỗ trợ tài chính cho các dự án nguồn mở mà sản phẩm của bạn cần sử dụng.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\u003cp\u003ePasskeys utilize passkey providers, like Google Password Manager or Apple iCloud Keychain, for secure credential generation and authentication.\u003c/p\u003e\n"],["\u003cp\u003eServer-side implementation involves passkey registration (storing public keys) and authentication (verifying signatures).\u003c/p\u003e\n"],["\u003cp\u003eUsing FIDO server-side libraries is recommended for simplified implementation, maintainability, and enhanced security.\u003c/p\u003e\n"],["\u003cp\u003eSeveral curated lists of FIDO server-side libraries are available for various programming languages, including JavaScript, Go, and Python.\u003c/p\u003e\n"]]],[],null,["| **Note:** This article is part of a series on server-side passkey implementation. Explore the other articles in this series: [Server-side passkey registration](/identity/passkeys/developer-guides/server-registration) and [Server-side passkey authentication](/identity/passkeys/developer-guides/server-authentication).\n\nOverview\n\nWhen using [synchronized passkeys](https://developers.google.com/identity/passkeys/supported-environments#:%7E:text=Passkeys%20can%20be%20synchronized%20across%20devices%20in%20the%20same%20ecosystem), people authenticate with a *passkey provider*.\n| **Key Term:** A *passkey provider* is a piece of software used to generate and provide cryptographically-secure credentials. Examples of passkey providers include Google Password Manager, Apple iCloud Keychain, Windows Hello, Dashlane and more.\n\nTo create and authenticate with passkeys, you will use the [WebAuthn API](https://developer.mozilla.org/docs/Web/API/Web_Authentication_API) for the web, or the [Credential Manager API](https://developer.android.com/training/sign-in/passkeys) for Android apps. These APIs handle the communication between the client and the passkey provider.\n\nWhile these APIs are called from a client such as a web page or Android app, you need to implement the rest of the functionality on the server to complete your authentication use cases.\n\nA passkey implementation consists of two functionalities:\n\n1. **Passkey registration.** Use the WebAuthn API or the Credential Manager API to let the user create a passkey. Store the associated public key on the server.\n2. **Authentication with a passkey**. Get an authentication challenge from the server and use the WebAuthn API or Credential Manager API to let the user sign this challenge with their passkey. Verify the signature on the server. If the signature is valid, authenticate the user.\n\nServer-side libraries\n\nWhile it's possible to implement server-side passkeys functionality from scratch, we recommend that you rely on a library instead.\n\nA server that supports passkey creation and authentication is called a *FIDO2 server* , or *FIDO server* for short. By extension, we'll refer here to server-side libraries that implement passkey support as *FIDO server-side libraries*.\n| **Note:** [FIDO2](https://fidoalliance.org/specifications/) is an umbrella term for the effort that produced the [WebAuthn API](https://developer.mozilla.org/docs/Web/API/Web_Authentication_API) and the [CTAP2 protocol](https://fidoalliance.org/specs/fido-v2.0-id-20180227/fido-client-to-authenticator-protocol-v2.0-id-20180227.html) that passkeys rely on.\n\nWhy use a library?\n\nUsing a FIDO server-side library has several advantages:\n\n- **Time and developer experience.** The [WebAuthn specification](https://www.w3.org/TR/webauthn/) is complex. FIDO server-side libraries can provide simple APIs for implementing passkeys, which can save you time and development resources.\n- **Maintainability.** The [WebAuthn specification](https://www.w3.org/TR/webauthn/) is still subject to change. Using the latest version of an actively maintained library helps keep your implementation up-to-date.\n- **Security and compliance.** You want your passkey implementation to conform to the WebAuthn specification and its security requirements. FIDO server-side libraries can help you keep your implementation secure and compliant with the specification. Depending on your product and industry, your implementation may also be subject to regulations that require you to use specific security standards for authentication.\n\nIf possible, consider financially supporting open source projects your product relies on.\n\nLibraries **Note:** To select your passkey library, refer to the [selection criteria](https://web.dev/blog/passkey-lib-criteria).\n\n- The [awesome-webauthn](https://github.com/herrjemand/awesome-webauthn) GitHub repository includes a [community-curated list of server-side libraries](https://github.com/herrjemand/awesome-webauthn#server-libraries). You'll find libraries for JavaScript and TypeScript, Go, Python, and more.\n- A [collection of libraries](https://passkeys.dev/docs/tools-libraries/libraries/) is available on [passkeys.dev](https://passkeys.dev/). It's maintained by the [W3C WebAuthn Adoption Community Group](https://www.w3.org/community/webauthn-adoption/).\n- FIDO Alliance references a [collection of FIDO2 servers](https://fidoalliance.org/certification/fido-certified-products/).\n\nNext up\n\n- [Server-side passkey registration](/identity/passkeys/developer-guides/server-registration)\n- [Server-side passkey authentication](/identity/passkeys/developer-guides/server-authentication)"]]