This gem provides JSON Web Token (JWT) based authentication.
Add this line to your application's Gemfile:
gem 'rack-jwt'And then execute:
$ bundle
Or install it yourself as:
$ gem install rack-jwt
use Rack::JWT::Auth secret: 'you_secret_token_goes_here', exclude: ['/api/docs']
Rails.application.config.middleware.use, Rack::JWT::Auth, secret: Rails.application.secrets.secret_key_base, exclude: ['/api/docs']
You can generate JSON Wen Tokens for your users using the Token#encode method
Rack::JWT::Token.encode(payload, secret)
- Fork it ( https://github.com/[my-github-username]/rack-jwt/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request