Keep getting OAuth::Unauthorized error when using oauth and twitter ruby gems

前端 未结 8 1200
抹茶落季
抹茶落季 2020-12-12 16:47

I am using the ruby twitter gem and oauth to gain access to users twitter accounts. In my code, I have:

unless @user.twitter_authd?
      oauth = Twitter::O         


        
相关标签:
8条回答
  • 2020-12-12 17:39

    This problem seems to be caused by twitter not being able to handle connection keep-alive correctly. Make sure you set connection=close http header in the request to twitter. Wasted a weekend debugging this.

    0 讨论(0)
  • 2020-12-12 17:42

    not enough info for me, but when was twitter gem last updated? twitter changed their oauth 'stuff' in mid may approx. perhaps you have an old one. I'd update your question to show the callback_url, and make sure you have the right token and secret, which it looks like you don't have.

    also, did you put the right callback url in your twitter app page? alot of times that screws you up too.

    if that fails use mbleighs twitter_auth instead. it worked for me and is pretty slick.

    0 讨论(0)
提交回复
热议问题