Skip to content

Add web authentication (passkey) support - #218

Open
leonvogt wants to merge 1 commit into
hotwired:mainfrom
leonvogt:webauthn-support
Open

leonvogt wants to merge 1 commit into
hotwired:mainfrom
leonvogt:webauthn-support

Conversation

@leonvogt

Copy link
Copy Markdown
Contributor

In the process of enabling passkey support to our apps, I've noticed that, passkey through the WebView works out-of-the box in iOS, but needs a small tweak in Android.
More specifically, one needs to create a custom WebView to enable WebSettingsCompat.setWebAuthenticationSupport().

This PR would make that obsolete. Hotwire Native will enable web authentication support, if the user opts in via Hotwire.config.webAuthenticationEnabled.
It defaults to false, same as the WebView itself.


For people who read this and are in the process of integrating passkeys:

  1. Make sure you have a Digital Asset Links association with the site (delegate_permission/common.get_login_creds)
  2. Only works with exactly those associated sites. So no localhost or self signed sites.
  3. The WebView sends the app identity as the WebAuthn origin (android:apk-key-hash:<hash>) rather than the web origin, so the server has to accept that too.

}

private fun initWebAuthentication() {
if (!Hotwire.config.webAuthenticationEnabled) return

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about add a DEBUG log to check early return?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, after thinking more about it, it might be a bit spammy to add a debug log here.

Since this code doesn't run only when webAuthentication is needed, but instead runs every time a WebView is created, and since most people don't use passkeys, I don't think such a debug log would be useful for the majority of devs.

If the code only executed when needed, like for camera or location permissions, I think such a debug log would be a great thing.

@leonvogt
leonvogt force-pushed the webauthn-support branch 2 times, most recently from aaf7b50 to 78ff648 Compare October 6, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants