问题:在使用 Devise Token 用户登录认证时,登录之前被拦截了。还是说 Devise 的 before_action :authenticate_sys_user!
会把 Devise 自带的 action 都给拦截了?
代码信息
class ApplicationController < ActionController::API
include DeviseTokenAuth::Concerns::SetUserByToken
before_action :authenticate_sys_user!
respond_to :json
end
Gem 文件
gem "devise"
gem "devise-encryptable"
gem 'devise_token_auth'
routes 文件
resources :sys_users
mount_devise_token_auth_for "SysUser", at: 'auth'
日志信息:
Started POST "/auth/sign_in" for ::1 at 2019-11-08 09:50:01 +0800
Processing by DeviseTokenAuth::SessionsController#create as JSON
Parameters: {"email"=>"[email protected]", "password"=>"[FILTERED]", "session"=>{"email"=>"[email protected]", "password"=>"[FILTERED]"}}
Filter chain halted as :authenticate_sys_user! rendered or redirected
Completed 401 Unauthorized in 1ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 163)