I'm a noob in LinQ and having troubles with Linq2Twitter and Twitter API in general.
I cannot understand how to get an authorized user's screen name, id, and name after a successful authorization.
I searched discussion threads online and the only advice I got from Joe was to use async call when querying for results. Except that I don't have the MaterializedAsyncCallback for some reason so I'm using AsyncCallback instead.
Here are the steps that I take all the way from authorizing to attempting to obtain the user's info:
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(); // Anything in this block is pointless // as I never get into this async callback block. // But this is where I expect to get the user's info // (screen name, name, id, etc.) });
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?