我有'device_token_auth‘(0.1.36) gem用于ROR应用程序中的令牌生成。我不太了解这个宝石的功能。突然,一个问题出现了
NoMethodError: undefined method `[]' for nil:NilClass
回溯图是这样的,
同一个gem的源代码device_token_auth
查看代码后,可以解释为缺少tokens[client_id]
或tokens
,但是由于调用者的app/controllers/devise_token_auth/concerns/set_user_by_token.rb:75 in update_auth_header
方法update_auth_header
已经处理了这种情况。
有人能告诉我问题出在哪里吗?
发布于 2018-09-11 19:28:33
我认为您使用的版本有点旧,根据this,这是一个已知的问题。在后来的版本中修复了这个问题。尝试升级gem,如果问题仍然存在,请让我知道。
发布于 2018-09-12 07:56:06
在config/application.rb中,在"class Application < Rails::Application“之后添加以下2行:
config.middleware.use ActionDispatch::Cookies
config.middleware.use ActionDispatch::Session::CookieStore
https://stackoverflow.com/questions/52274179
复制相似问题