1
我使用devise_token_auth(https://github.com/lynndylanhurley/devise_token_auth)對移動設備進行身份驗證,並且還需要爲我的web應用程序使用devise。將devise_token_auth庫用於webapp和api
問題是用戶可以通過devise_token_auth註冊,但是如果用戶登錄並嘗試調用某個包含「before_action :authenticate_user!
」的控制器中的某個函數,則會出現一條錯誤消息Authorized Users Only
。
我想知道是否有辦法一起使用devise
和devise_token_auth
。
代碼:
class RestrictedController < ApplicationController
before_action :authenticate_user!
def stuff
head :ok
end
end