你如何在rails-api中使用authenticate_with_http_token?

and*_*rov 24 rails-api

我正在使用rails-api并且需要使用authenticate_with_http_token来处理标头授权令牌,但是我收到以下错误:

NoMethodError (undefined method `authenticate_with_http_token' for ...)
Run Code Online (Sandbox Code Playgroud)

and*_*rov 39

添加以下内容 ApplicationController

  include ActionController::HttpAuthentication::Token::ControllerMethods
Run Code Online (Sandbox Code Playgroud)