Hi there.
I'm a noob in LinQ and having troubles with Linq2Twitter and Twitter API in general.
I cannot understand how to get the authorized user's screen name, id, and name after successful authorization.
I searched the discussion threads and the only advice I got was to use async call when querying for results.
Here are the steps that I make:
-
Create a PinAuthorizer with my consumer key and secret as credentials
this.pinAuth = new PinAuthorizer
{
Credentials = new InMemoryCredentials
{
ConsumerKey = CONSUMER_KEY,
ConsumerSecret = CONSUMER_SECRET
},
UseCompression = true,
GoToTwitterAuthorization = pageLink =>
Dispatcher.BeginInvoke(() => {
WebBrowser.Navigate(new Uri(pageLink + "&force_login=true", UriKind.Absolute));
})
};
-
Authorize Begin
this.pinAuth.BeginAuthorize(resp => ...
-
Enter the pin and thus getting access token and secret in pinAuth.OAuthTwitter:
pinAuth.CompleteAuthorize(
this.pin,
completeResp => Dispatcher.BeginInvoke(() =>
{ ...
-
Then, I try to get the user ... with an async call as that's what Joe Mayo recommended in other threads.
ITwitterAuthorizer auth = pinAuth;
TwitterContext twitterCtx = new TwitterContext(pinAuth);
(from user in twitterCtx.User
where user.UserID != "JoeMayo"
select user)
.AsyncCallback(asyncResponse => {
var response = asyncResponse.ToList();
User acc = response.FirstOrDefault();
});
I never get the async response.
(I also do not have MaterializedAsyncCallback for some reason).
How do I get the authorized user's screen name, id, and name?
|