标签: ruby-on-rails devise jwt
我安装了devise + devise_jwt,令牌返回(他包含用户的ID)。用before_action :authenticate_user!创建新控制器(例如,评论)后,收到:You need to sign in or sign up before continuing.我想使用以下设计的过滤器和帮助器:current_user,user_signed_id?,{{1} }。如果我只显示current_user,我将为null。 可能是谁知道怎么了?
devise
devise_jwt
before_action :authenticate_user!
You need to sign in or sign up before continuing.
current_user
user_signed_id?
链接到我正在做的教程-https://medium.com/@nandhae/2019-how-i-set-up-authentication-with-jwt-in-just-a-few-lines-of-code-with-rails-5-api-devise-9db7d3cee2c0