1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Rails】DeviseTokenAuthのNoMethodError (undefined method `downcase' for nil:NilClass)対処法

Posted at

状況

Devise Token Authの設定に以下の項目を追加したところログイン時にNoMethodError (undefined method downcase' for nil:NilClass)`となりました。

devise_token_auth.rb
DeviseTokenAuth.setup do |config|

  config.headers_names = { "access-token": "access-token",
                           client: "client",
                           expiry: "expiry",
                           uid: "uid",
                           "token-type": "token-type" }

end

解消法

以下のようにauthorization: "authorization"を追記することで解消しました。

devise_token_auth.rb
DeviseTokenAuth.setup do |config|

  config.headers_names = { "access-token": "access-token",
                           client: "client",
                           expiry: "expires",
                           uid: "uid",
                           "token-type": "token-type",
                           authorization: "authorization" }

end

参考

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?