Android FIDO2 抛出模糊错误

问题描述 投票:0回答:5

我正在尝试在 Android 上实现 FIDO2。我的域上托管有 assetlinks.json(抱歉,我不想也不确定是否允许透露整个 url)。 我定义了 asset_statements 字符串并将其添加到我的清单中,并且还实现了整个获取注册质询逻辑,其中我从 PublicKeyCredentialCreateOptions 创建待处理意图。 启动意图后,我看到一个白色屏幕,它显示并关闭得非常快,没有任何描述性错误或任何东西,我不知道如何调试这个问题。日志显示:

ActivityTaskManager: Displayed com.google.android.gms/.fido.fido2.ui.Fido2FullScreenActivity
E/Fido: [DigitalAssetsAssociationChecker] JSON Object doesn't have linked key
E/Fido: [Fido2RequestController] The incoming request cannot be validated
E/Fido: [Fido2RequestController] The incoming request cannot be validated

https://developers.google.com/digital-asset-links/tools/generator 上,它表示我的域授予应用程序深度链接到我的包名称。

我正在使用

com.google.android.gms:play-services-fido:18.1.0

日志中的错误没有任何帮助,我不确定我是否仍然遗漏了一些东西,任何帮助将不胜感激。

android authentication webauthn fido
5个回答
3
投票

好吧,我通过使用示例应用程序 https://github.com/googlecodelabs/fido2-codelab 并更改周围的内容来解决这个问题,所以我要回答我自己的问题。 请求注册质询时,RP.id 字段需要与您的域名相同。 在示例中,Rp.id 值为“webauthn-codelab.glitch.me”,我将其更改为“webauthn.glitch.me”只是为了尝试会发生什么。你猜怎么着,我遇到了和以前一样的错误:

E/Fido: [DigitalAssetsAssociationChecker] JSON Object doesn't have linked key
E/Fido: [Fido2RequestController] The incoming request cannot be validated
E/Fido: [Fido2RequestController] The incoming request cannot be validated

总而言之,请确保从后端返回的 RP.id 与域 url 匹配。 这里还有一个解释 RP id 的链接:https://www.w3.org/TR/webauthn-2/#relying-party-identifier


2
投票

出现此错误的另一个原因是:如果 assetlinks.json 中缺少关系

delegate_permission/common.handle_all_urls
,Android 设备可能会拒绝与上述错误关联。

因此,例如以下资产链接(我直接从docs中复制的)将被拒绝并出现上述错误:

[{
  "relation": ["delegate_permission/common.get_login_creds"],
  "target": {
    "namespace": "web",
    "site": "https://signin.example.com"
  }
 },
 {
  "relation": ["delegate_permission/common.get_login_creds"],
  "target": {
    "namespace": "android_app",
    "package_name": "com.example",
    "sha256_cert_fingerprints": [SHA_HEX_VALUE]
  }
 }]

我的例子的解决方案是添加

handle_all_urls
关系:

[{
  "relation": ["delegate_permission/common.handle_all_urls", "delegate_permission/common.get_login_creds"],
  "target": {
    "namespace": "web",
    "site": "https://signin.example.com"
  }
 },
 {
  "relation": ["delegate_permission/common.handle_all_urls", "delegate_permission/common.get_login_creds"],
  "target": {
    "namespace": "android_app",
    "package_name": "com.example",
    "sha256_cert_fingerprints": [SHA_HEX_VALUE]
  }
 }]

1
投票

同样的症状。

就我而言,问题是我试图在内部开发服务器上托管 assetlinks.json 文件。

这不起作用。

assetlinks.json 文件必须托管在 Google 服务器可公开访问的服务器上。



-1
投票

JSON Object doesn't have linked key
通话中遇到同样的错误
Fido2ApiClient.getSignPendingIntent()
。 我的案例的解决方案是在
allowList
中设置真实用户密钥(又名 id)。

© www.soinside.com 2019 - 2024. All rights reserved.