I make API in rails. For normal authentication we use devise but in API how to implement devise for authentication.
gem 'devise_token_auth'
Someone prefer this this gem for authentication but there are no tutorial available for that. How to implement authenitication in rails api?
Here is a good tutorial on API authentication with devise_token_auth. Also, the devise_token_auth gem's github page seems to have a very good documentation which should help you get started.
If you are looking for a good tutorial to understand the related concepts, here is one that has a thorough walkthrough of creating a Rails API with token-based authentication (Not using devise_token_auth
, but useful to understand the concepts).
I also recommend you to take a look at the JWT (JSON Web Token) which works very well with large scale Rails API. Here is another tutorial that explains how to build Rails API Backed With JWT