Skip to content

Token-based authentication with Ruby on Rails 5 API

Notifications You must be signed in to change notification settings

Bellov/jwt-auth-rails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

Rails Gems:

gem 'bcrypt', '~> 3.1.7' gem 'jwt' gem 'simple_command'

Rails Commands

1) bundle
2) rails db:create
3) rails db:migrate
4) rails db:seed
5) rails s

Create account: Rails c

User.create!(email: 'admin@gmail.com' , password: 'adminadmin' , password_confirmation: 'adminadmin')

Commands for API:

$ curl -H "Content-Type: application/json" -X POST -d '{"email":"admin@gmail.com","password":"adminadmin"}' http://localhost:3000/login

$ curl -H "Authorization: <tokken>" http://localhost:3000/items

Example:
curl -H "Authorization: eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyLCJleHAiOjE1MTA4NTQ1NjZ9.En-1ZmziPeorKklNESHQTbzRrFrAH-fDIn8hwWgdK2k" http://localhost:3000/items

About

Token-based authentication with Ruby on Rails 5 API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published