代码之家  ›  专栏  ›  技术社区  ›  Sourabh Banka

无法自动加载常量jwt黑名单,应为/主页/sourabh/开发/庆祝/应用程序/型号/jwt\U黑名单。rb定义它(LoadError)

  •  0
  • Sourabh Banka  · 技术社区  · 7 年前

    我的用户。rb模型包含:

    class User < ApplicationRecord
    
      devise :database_authenticatable, :registerable,
             :recoverable, :rememberable, :trackable, :validatable,
             :confirmable, :lockable, :timeoutable, :omniauthable,
             :jwt_authenticatable, jwt_revocation_strategy: JWTBlacklist
    
      def send_devise_notification(notification, *args)
        devise_mailer.send(notification, self, *args).deliver_later
      end
    end
    

    我正在使用Desive jwt gem登录我的rails api。

    我的JWT黑名单。rb模型包含:

    class JwtBlacklist < ApplicationRecord
      include Devise::JWT::RevocationStrategies::Blacklist
    
      self.table_name = 'jwt_blacklist'
    end
    
    1 回复  |  直到 7 年前
        1
  •  10
  •   matthewd    7 年前

    你的 User 班级正在寻找 JWTBlacklist ,但您的文件正在定义 JwtBlacklist 。您需要更改其中一个以匹配另一个。