Token Based Authentication API in Rails with the help of JWT and Knock

rails new project_name --api -d mysql
gem 'knock' gem 'jwt'
bundle install
rails generate knock:install rails generate knock:token_controller user
rails generate model users rails generate controller users rails generate controller home
rake db:migrate
Add include Knock::Authenticable
Add before_action :authentication_user, only[:auth]

Cryptex Technologies

Written by

Cryptex specializes in developing open source web applications and software solutions across all domains and verticals using Ruby on Rails (ROR) technology

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade