This project has moved and is read-only. For the latest updates, please go here.

Is it possible to retrieve the Twitter userid of a user from the access token?

Oct 2, 2013 at 4:35 PM

Let me explain my problem, currently I use LinqToTwitter to perform the authorization of a user.

I have the Connect Twitter button on my website, when the user click on it, an ajax request requests the method to perform authorization, the user is redirect to "" and then enter his login and password. Once it's done, it is redirect to the urlReferrer of my website and I receive the fields I need like username, userid, ....

Then if the UserId of the social network user doesn't match with any entries of my database I open a popup to ask for his email ( Email is a required field)

Then, once the email has been confirmed by the user, I have to connect him in our website by making an ajax request connectSocialUser(userid, avatar, accessToken).

For Google and Facebook I have put in parameter the access token and then request respectively these two urls :
These two urls give me back the userid and by a simple comparison I can know that the user is the good one and not an usurper.

So my question is : Is it possible to retrieve the userid of a user from the access token ?

If not how can I make this works?

Thank you a lot!
Oct 2, 2013 at 8:15 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Oct 2, 2013 at 8:18 PM
I just answered this question on SO:

That said, there are ScreenName and UserID properties on TwitterContext. ScreenName seems to be populated, but UserID was blank, so I copied this to a Work item to check that part out.

In the meantime, you can get this info from auth.Credentials after authorization.