Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you use authenticate_with_http_token with rails-api?

Tags:

rails-api

I am using rails-api and need to use authenticate_with_http_token to process a header authorization token, but i get the following error:

NoMethodError (undefined method `authenticate_with_http_token' for ...) 
like image 361
andorov Avatar asked Oct 28 '14 19:10

andorov


People also ask

What is JWT authentication in Rails?

JSON Web Tokens, commonly known as JWT is an open standard for representing and verifying claims securely between a client and a server. It is one of the most popular authentication and authorization techniques employed in modern applications.


1 Answers

Add the following to ApplicationController

  include ActionController::HttpAuthentication::Token::ControllerMethods 
like image 66
andorov Avatar answered Sep 19 '22 01:09

andorov