Rodauth: Ruby's Most Advanced Authentication Framework

# cat config.ru
require "roda"

class RodauthApp < Roda
  secret = ENV['SESSION_SECRET']
  plugin :sessions, secret: secret

  # If using Rodauth in a non-Roda application
  # plugin :middleware

  # JSON API
  #plugin :json
  #plugin :json_parser

  plugin :rodauth do
    enable :login, :logout, :verify_account
    enable :webauthn, :otp, :recovery_codes
    hmac_secret secret

    # JSON API
    #enable :jwt
    #jwt_secret secret
    #only_json? false
  end

  route do |r|
    r.rodauth

    rodauth.require_authentication

    # If using Rodauth in a Roda application
    # Your app code here
  end
end

# If using Rodauth in a non-Roda application
# use RodauthApp

# If using Rodauth in a Roda application
run RodauthApp

Rodauth is Ruby's most advanced authentication framework. Find out why you should use it.