SimpleJwtAuth
This gem provides simple jwt authorization for rails API projects by giving you access to POST for users and sessions. Aswell as a current_user helper method.
Installation
Add this line to your application's Gemfile:
gem 'simple_jwt_auth'
And then execute:
$ bundle
Or install it yourself as:
$ gem install simple_jwt_auth
Usage
Models
After installation run
$ rails simple_jwt_auth:install:migrations
this will create a user model in your rails application.
then run
$ rails db:migrate
Routes
in order to access gems provided routes add
mount SimpleJwtAuth::Engine, at: "/auth"
to the top of your routes in your rails project
Creating Users
Users can be created by making a POST request to https://localhost:3000/auth/users With name, email, password, and password_confirmation as params
Creating Sessions
Sessions can be created by making a POST request to https://localhost:3000/auth/sessions with email and password as params.
Logged in
Add header called "Authorization" and set it to "Bearer
License
The gem is available as open source under the terms of the MIT License.