Priyanka
Priyanka

Reputation: 836

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!

Upvotes: 8

Views: 6621

Answers (2)

Rantir
Rantir

Reputation: 111

While it is not officially supported, it can be done using a third party solution: https://hwsecurity.dev/guide/fido-webview/

They inject a JavaScript bridge which redirects the navigator.credentials calls to their FIDO2 implementation. Works great for me.

Upvotes: 0

Tangui
Tangui

Reputation: 3954

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.

Upvotes: 7

Related Questions