Search code examples
androidfido-u2fwebauthnfido

Android WebView Support WebAuthn?


I am not an android developer and stuck at an android thing. I hope someone here can help me out.

I am implementing WebAuthn/FIDO2 on my website, which is working perfectly fine with the browsers. But when I open my website in my android app (android.webkit.webview), it gives me the error

I/chromium: [INFO:CONSOLE(136)] "Got error-NotSupportedError: The user agent does not support public key credentials." 

Code sample which I am using in my website is something like:

navigator.credentials.create({ publicKey })

Opening https://webauthn.io/ in my app, says "this browser isn't currently supported"

Can't we update webView somehow?

I am using sdk version (API 26,Android 8.0 oreao)

Is there any workaround?

Thanks in advance!


Solution

  • Simply put: it is not and won't be implemented in Android Webview (source), for security reasons.

    So as to use WebAuthn from your application, you have to redirect to the browser, either directly or using SFSafariViewController (iOS) or Android Custom Tab (Android) as explained in RFC8252 - Appendix B.