后端笔记
复制一个包含安装步骤和本插件完整 Markdown 指南的配置提示。
您的后端仍然拥有正常的 WebAuthn 仪式:
- 生成注册和身份验证挑战
- 验证证明和断言响应
- 强制依赖方 ID 和挑战验证
- 存储凭据和计数与浏览器流程相同
什么保持不变
标题为“什么保持不变”该插件旨在保留您的现有 WebAuthn code 的前端形状。
- 在 Web 上,它将请求转发到真实的浏览器 WebAuthn API。
- 在本机 Capacitor 上,它返回由本机 passkey API 支持的浏览器类凭据对象。
- 您的后端可以保持相同的挑战和验证管道。
Android 中发生的变化
Android 中发生的变化Android 本机 passkeys 与浏览器信任模型不完全相同。
- 数字资产链接使 Android 能够与您的网站共享相同的依赖方和凭据生态系统。
- literal 的
clientDataJSON.origin值仍然可能与网站起源不同。 - 如果您的服务器拒绝除了
https://your-domain,
Recommended backend rule
Section titled “Recommended backend rule”Allow the expected browser origin and the expected Android app origin for the same relying party when you support native Android passkeys.
That gives you:
- browser support for the website
- native passkey support in the Capacitor app
- one passkey ecosystem for the same relying-party domain
If you need direct JSON-safe calls
Section titled “If you need direct JSON-safe calls”If your backend already returns PublicKeyCredentialCreationOptionsJSON and PublicKeyCredentialRequestOptionsJSON, you can also use the direct plugin API instead of the browser-style shim:
import { CapacitorPasskey } from '@capgo/capacitor-passkey';
const registration = await CapacitorPasskey.createCredential({ origin: 'https://signin.example.com', publicKey: registrationOptionsFromBackend,});
const authentication = await CapacitorPasskey.getCredential({ origin: 'https://signin.example.com', publicKey: requestOptionsFromBackend,});继续从后端笔记
标题:继续从后端笔记如果您正在使用 后端笔记 来规划身份验证和帐户流程,连接它到 使用@capgo/capacitor-passkey 为native能力在使用@capgo/capacitor-passkey @capgo/capacitor-social-login 为实现细节在@capgo/capacitor-social-login @capgo/capacitor-passkey 为实现细节在@capgo/capacitor-passkey @capgo/capacitor-native-生物识别 为 @capgo/capacitor-native-生物识别 的实现细节 双因素认证 为双因素认证的实现细节