我不是 Android 开发人员,我一直在做 Android 方面的事情。我希望这里有人可以帮助我。
我正在我的网站上实现 WebAuthn/FIDO2,它在浏览器上运行得非常好。 但是当我在我的 android 应用程序 (android.webkit.webview) 中打开我的网站时,它给了我错误
I/chromium: [INFO:CONSOLE(136)] "Got error-NotSupportedError: The user agent does not support public key credentials."
我在我的网站上使用的代码示例是这样的:
navigator.credentials.create({ publicKey })
开幕https://webauthn.io/在我的应用程序中,显示“当前不支持此浏览器”
我们不能以某种方式更新 webView 吗?
我使用的是 sdk 版本 (API 26,Android 8.0 oreao)
有什么解决方法吗?
提前致谢!
最佳答案
简单地说:出于安全原因,它不会也不会在 Android Webview ( source ) 中实现。
为了在您的应用程序中使用 WebAuthn,您必须直接重定向到浏览器,或者使用 SFSafariViewController (iOS) 或 Android 自定义选项卡 (Android),如 RFC8252 - Appendix B 中所述。 .
关于Android WebView 是否支持 WebAuthn?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56258147/