Question

I'm trying to get the username of an authorised user. I've already managed to get the OAuth to work, have got the token, directed the user to retrieve the PIN, entered that and sent a tweet successfully. But what I don't understand is WHEN and HOW to get the username.

I used this VB.NET code to get the URL:

Dim ReqTokens = OAuthUtility.GetRequestToken("XXX", "XXX", "oob")
Dim url = (OAuthUtility.BuildAuthorizationUri(ReqTokens.Token).AbsoluteUri)
TextBox2.Text = url

This code then confirmed authorisation and allows me to tweet using the app:

OAuthUtility.GetAccessToken("XXX", "XXX", "XXX", "1234567")

But at which stage, and HOW, do I retrieve the username and user ID?

Any help in VB.NET, and simplified for the dunce I clearly am, would be much appreciated!

Was it helpful?

Solution

OAuthUtility.GetAccesToken() returns a OAuthTokenResponse which contains the ScreenName and Id property. Doc is here

Dim accessTokens = OAuthUtility.GetAccessToken("")
Dim screenName as String = accessTokens.ScreenName
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top