Multi-Factor Authentication for Rails with WebAuthn and Devise

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • Devise

    Flexible authentication solution for Rails with Warden.

  • In this article, I will demonstrate how to implement WebAuthn with Devise, a popular authentication library for Rails. All the mentioned options (security keys, Windows Hello, and Apple Touch/Face ID) will be available to use within the application.

  • webauthn-with-devise

    The companion app for the article "Secure authentication for Rails with WebAuthn and Devise"

  • I created a GitHub repository with all of the code used in this article. The application uses Rails 6.1 with Turbo and Stimulus. When I use Turbo, I will also inform you of an option that can be used when Turbo is not available in your application.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • vite_ruby

    ⚡️ Vite.js in Ruby, bringing joy to your JavaScript experience

  • The main difference in this application compared to Rails defaults is the use of Vite instead of Webpacker. Vite is just a modern alternative to Webpack. If you are already using Webpacker, you only need to change the path for the Stimulus controllers (probably app/javascript/controllers instead of app/frontend/controllers/, which is used with Vite).

  • webauthn-ruby

    WebAuthn ruby server library ― Make your Ruby/Rails web server become a conformant WebAuthn Relying Party

  • Luckily, there is a WebAuthn gem for Ruby (thanks!) that will do all the hard work for us. Just run bundle add webauthn.

  • webauthn-json

    🔏 A small WebAuthn API wrapper that translates to/from pure JSON using base64url.

  • First, we will add the necessary NPM packages. We will use @github/webauthn-json as a nice wrapper for the WebAuthn API and @rails/request.js for easier requests to the backend (with built-in Turbo Stream support).

  • request.js

  • First, we will add the necessary NPM packages. We will use @github/webauthn-json as a nice wrapper for the WebAuthn API and @rails/request.js for easier requests to the backend (with built-in Turbo Stream support).

  • Tailwind CSS

    A utility-first CSS framework for rapid UI development.

  • For some styling and icons, I used Tailwind CSS 2 and Font Awesome 5 in a free version.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • Ruby on Rails

    Ruby on Rails

  • There are several ways to add multi-factor authentication (MFA) for safer user authentication. Let’s look at how to add a modern MFA approach to a Rails application with WebAuthn.

  • Font-Awesome

    The iconic SVG, font, and CSS toolkit

  • For some styling and icons, I used Tailwind CSS 2 and Font Awesome 5 in a free version.

  • Bitwarden

    The core infrastructure backend (API, database, Docker, etc). (by bitwarden)

  • The most common MFA methods utilize OTPs via SMS (which are not as secure as they seem to be) or an authenticator application, such as the Google Authenticator app, or a modern password manager (such as Bitwarden or 1Password).

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts