A step-by-step guide to implementing passwordless authentication with Passkeys (WebAuthn) in a Rails 8 app. Covers database setup for storing passkey credentials, configuring the webauthn-ruby gem, building registration and login controller actions with challenge/response flows, and wiring up a Stimulus controller using the @github/webauthn-json library to handle browser API interactions. Explains the public key cryptography mental model without requiring deep crypto knowledge.
Table of contents
The Mental Model: How Passkeys WorkSTEP 1: The Database SetupSTEP 2: The Gem and ConfigurationSTEP 3: The Backend Logic (Registration)STEP 4: The Javascript (Stimulus)What about Logging In?Summary93 Impressions