过滤链停止为:authenticate_user!渲染或重定向

Nit*_*wal 8 devise

我有一个问题.我正在关注我的工作https://www.airpair.com/ruby-on-rails/posts/authentication-with-angularjs-and-ruby-on-rails.

使用ng-token-auth和devise_token_auth

在Controller类MyController <ApplicationController before_filter:authenticate_user!中,除了:[:new,:create]

但所有API的调用都得到"过滤器链停止为:authenticate_user!呈现或重定向"

任何建议都会有帮助

Fra*_*int 0

好的,当然,这个怎么样?:

在 after_token_authentication 中将您的调用从 @user 更改为 @current_user。您是authenticate_user!调用需要@current_user

sign_in @current_user, :bypass => true
Run Code Online (Sandbox Code Playgroud)