我试图通过门卫和门卫文档使用许可,我必须像这样访问User对象:
resource_owner_authenticator do
@user = env[:clearance].current_user
unless @user
session[:return_to] = request.fullpath
redirect_to(sign_in_url)
end
@user
end
https://github.com/doorkeeper-gem/doorkeeper/wiki/Authenticating-using-Clearance-or-DIY
但是我从哪里获取env
变量?另外,我试图在session[:current_user]
和session[:user]
中找到该用户,但它不存在。
谢谢