Skip to content
This repository was archived by the owner on Oct 2, 2024. It is now read-only.
/ rack-jwt Public archive

Rack middleware that provides authentication based on JSON Web Tokens

License

Notifications You must be signed in to change notification settings

fgrehm/rack-jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rack::JWT

Gem Version Build Status Code Climate

This gem provides JSON Web Token (JWT) based authentication.

Installation

Add this line to your application's Gemfile:

gem 'rack-jwt'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rack-jwt

Usage

sinatra

use Rack::JWT::Auth secret: 'you_secret_token_goes_here', exclude: ['/api/docs']

Rails

Rails.application.config.middleware.use, Rack::JWT::Auth, secret: Rails.application.secrets.secret_key_base, exclude: ['/api/docs']

Generating tokens

You can generate JSON Wen Tokens for your users using the Token#encode method

Rack::JWT::Token.encode(payload, secret)

Contributing

  1. Fork it ( https://github.com/[my-github-username]/rack-jwt/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

Rack middleware that provides authentication based on JSON Web Tokens

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages