tags:

views:

14

answers:

0

Ok, so am using the Twitter gem version 0.9.12 and I have successfully figured out how to do the OAuth dance and get the users access token and access secret that I can store securely in the database to send tweets on the users behalf from my rails app.

The problem I am having is that I want to display a message to the user in their account settings something like so: You Have Successfully Authorized, "Twitter Account Name Here".

But, twitter is not sending back the screen name when they send the access token and access secret.

According to this: http://dev.twitter.com/pages/auth

I should get the following back:

oauth_token=819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw&oauth_token_secret=J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA&user_id=819797&screen_name=episod

But, I am not getting the user_id or the screen_name at all. Only the token and secret. Did twitter change the response to not include the user_id and screen name? I want to be able to store the screen name for the message I want to display to the user.

Is there another way using the twitter gem to get the users screen name?

I thought about doing this:

  twitter = Twitter::Base.new(oauth)
  twitter.user_timeline.first.user.screen_name

And that works except in the case that the user doesn't have any tweets. I need to be able to account for the scenario where a user has just signed up for twitter or hasn't tweeted yet.

When reading the source of the twitter gem, the user method requires passing a user_id or screen_name, both of which I don't have.

What am I missing? How can I solve this issue?

Thanks in advance for any help.