Skip to content

JackVCurtis/devise-passkeys-example

Repository files navigation

README

Running the example

Install dependencies:

bundle

Follow the instructions (here)[https://admin.passwordless.dev/signup] to create a Passwordless.dev account with Bitwarden. Then create your free application. You will be given three values: An API URL, an API private key, and an API public key. Create a .env file and provide these values:

BITWARDEN_PASSWORDLESS_API_URL=
BITWARDEN_PASSWORDLESS_API_PRIVATE_KEY=
BITWARDEN_PASSWORDLESS_API_PUBLIC_KEY=

Ensure you have Postgresql installed and running locally. Then run:

rails db:create
rails db:migrate
rails s

Adding passkeys to a Rails 7 app.

  1. Install Devise and associate it to a User model. You can optionally remove the password field before running the migration.
  2. Install the Bitwarden Passwordless.dev JS client using your choice of package manager. The example uses import-maps.
  3. Add the Devise module and strategy from lib/devise in this example.
  4. Generate the Devise controller for sessions and configure your routes like so:
  devise_for :users, controllers: {
    sessions: "users/sessions"
  }
  1. Replace the contents of app/controllers/users/sessions.rb with the contents of the matching file in this example.
  2. Add the Stimulus controller in app/javascript/controllers/passwordless_controller.js.
  3. Navigate to your new combined signup/login page and test it out.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published