Module: AuthAction::Rails::JwtAuthenticatable

Extended by:
ActiveSupport::Concern
Defined in:
lib/authaction/rails/jwt_authenticatable.rb

Overview

ActiveSupport::Concern that adds JWT authentication to a Rails controller.

Configure via environment variables:

AUTHACTION_DOMAIN   = myapp.eu.authaction.com
AUTHACTION_AUDIENCE = https://api.myapp.com

Examples:

class ApplicationController < ActionController::API
  include AuthAction::Rails::JwtAuthenticatable
end

class ProtectedController < ApplicationController
  before_action :authenticate_request!

  def index
    render json: { sub: @current_payload["sub"] }
  end
end