You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

安卓端Chrome无法保存Passkey的技术问题求助

Passkey安卓Chrome认证问题排查方案

核心问题分析

Windows端Chrome正常,安卓端Chrome注册流程完成后无法找到关联Passkey,调用navigator.credentials.get()提示无关联凭证,根源大概率是凭证类型不匹配、参数传递错误或RP ID配置问题,以下是具体排查点:

1. 注册时未要求创建可发现凭证(Resident Key)

Passkey的核心定义是可发现凭证(Discoverable Credential),需要在注册时明确要求验证器将凭证存储到本地(即Resident Key)。你的注册选项中:

"authenticatorSelection": {"requireResidentKey": false,"userVerification": "preferred"}

requireResidentKey: false会创建不可发现凭证,这类凭证不会被安卓Chrome的密码管理器识别为Passkey(Windows端Chrome可能因平台验证器的特殊逻辑兼容)。

修复方案:
将requireResidentKey改为true:

"authenticatorSelection": {
  "requireResidentKey": true,
  "userVerification": "preferred"
}

2. rawId参数传递错误

注册提交时,你的代码将rawId直接设为this.credential.id:

this.credentialsCopy = {
  type: this.credential.type,
  id: this.credential.id,
  rawId: this.credential.id, // 错误:id是base64url编码后的字符串,rawId需要原始ArrayBuffer转base64url
  response: {attestationObject,clientDataJSON}
}

credential.id是经过base64url编码的字符串,而rawId必须是原始credential.rawId(ArrayBuffer)转成的base64url格式。服务器存储错误的rawId后,后续调用get()时无法匹配到对应凭证。

修复方案:

const rawId = this.bufferToBase64URL(this.credential.rawId);
this.credentialsCopy = {
  type: this.credential.type,
  id: this.credential.id,
  rawId: rawId,
  response: {attestationObject,clientDataJSON}
}

3. RP ID配置不符合规范

检查服务器返回的rp.id是否为裸域名或注册域名,不能包含http://、https://或端口号。例如:

  • 正确格式:example.com或app.example.com
  • 错误格式:https://example.com或example.com:3000

安卓Chrome对RP ID的校验更严格,若格式错误,验证器不会将凭证关联到当前网站,导致密码管理器无法识别。

4. 安卓Chrome密码管理器同步问题

若上述配置都正确,可能是安卓Chrome的密码管理器未同步凭证:

  • 确保安卓设备已登录Google账号并开启密码同步
  • 重启Chrome或手动触发密码同步(设置→密码→同步密码)

内容的提问来源于stack exchange,提问作者Robba

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 00:12:02