首页 文章

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

提问于
浏览
22

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

NoMethodError (undefined method `authenticate_with_http_token' for ...)

1 回答

  • 37

    将以下内容添加到 ApplicationController

    include ActionController::HttpAuthentication::Token::ControllerMethods
    

相关问题