LoginSignup
7
5

More than 5 years have passed since last update.

omniauth-twitter で 400 Bad Request がでたときの解決方法

Last updated at Posted at 2015-10-22

twitterログインで400 Bad Requestが出て困りました。

/auth/twitter へアクセスしたらエラー

http://localhost:8888/auth/twitter をアクセスしたら以下のエラーがでました。

ログインでエラー
OAuth::Unauthorized 400 Bad Request

スクリーンショット 2015-10-22 20.51.38.png

オワタ\(^o^)/

api_key と api_secretを記述

config/secrets.ymlの設定がおかしかったです。

secrets.yml
default_twitter: &default_twitter
  twitter_api_key: 'vc41puZxkIMCR4Z1b0qN2Jcgi'
  twitter_api_secret: 'W3lEwssDxwlESlcGPuhIpG9d49zZuK0VCN60s53B0OmYkImYGI'

twitter_api_keyとtwitter_api_secretを設定しました。一応上記は記事用の適当な文字列を入れています。

再度アクセス

今度は直りました(☝ ՞ਊ ՞)

参考

7
5
2

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
7
5