Skip to content

Add web authentication (passkey) support - #218

Merged
mbarta merged 3 commits into
hotwired:mainfrom
leonvogt:webauthn-support
Nov 3, 2026
Merged

mbarta merged 3 commits 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
leonvogt and others added 2 commits November 3, 2026 16:44
In app mode the WebView sends the app's identity instead of the page's
origin, so any page in the WebView can request passkeys for the app's
associated sites. Each WebView also reads the flag only when it's
created, so the flag has to be set before any WebView exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WebView first reported WEB_AUTHENTICATION in 126, not 121, and 130
reported it as unsupported. The feature check is what the code relies
on, so the doc should name that check instead of a version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@mbarta mbarta left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you

@mbarta
mbarta merged commit ee17fe6 into hotwired:main Nov 3, 2026
1 check passed
@leonvogt
leonvogt deleted the webauthn-support branch November 3, 2026 16:08
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.

3 participants