'await pinAuth.BeginAuthorizeAsync();' causing : 'LinqToTwitter.TwitterQueryException'

Feb 7, 2014 at 6:16 PM
Hi,
I'm currently working on a project and i'm wanting to incorparate twitter into this project via Linq2Twitter. I've been following the demo for posting tweets and OAuth, however i've come into a problem, when i run:
async void Button_Click(object sender, RoutedEventArgs e)
        {
            pinAuth = new PinAuthorizer
            {
                CredentialStore = new InMemoryCredentialStore
                {
                    ConsumerKey = "#################",
                    ConsumerSecret = "################################"
                },
                GoToTwitterAuthorization = pageLink => Dispatcher.BeginInvoke(
                    () => OAuthWebBrowser.Navigate(new Uri(pageLink, UriKind.Absolute)))
            };

            await pinAuth.BeginAuthorizeAsync();
        }
I get the error :
An exception of type 'LinqToTwitter.TwitterQueryException' occurred in mscorlib.ni.dll but was not handled in user code.

With the following data: [Data](http://pastebin.com/qUWrFG8B)
Here is my whole OAuth.xaml:
using System;
using System.Linq;
using System.Windows;
using LinqToTwitter;
using Microsoft.Phone.Controls;

namespace TwitterLinq
{
    public partial class OAuth : PhoneApplicationPage
    {
        PinAuthorizer pinAuth = new PinAuthorizer();
        public OAuth()
        {
            InitializeComponent();

        }
        async void AuthorizationButton_Click(object sender, RoutedEventArgs e)
        {
            await pinAuth.CompleteAuthorizeAsync(PinTextBox.Text);
            SharedState.Authorizer = pinAuth;
            NavigationService.GoBack();
        }
        async void Button_Click(object sender, RoutedEventArgs e)
        {
            pinAuth = new PinAuthorizer
            {
                CredentialStore = new InMemoryCredentialStore
                {
                    ConsumerKey = "#################",
                    ConsumerSecret = "############################"
                },
                GoToTwitterAuthorization = pageLink => Dispatcher.BeginInvoke(
                    () => OAuthWebBrowser.Navigate(new Uri(pageLink, UriKind.Absolute)))
            };
            await pinAuth.BeginAuthorizeAsync();
        }
    }
}
Is there anything I'm missing which is causing this problem?
If needed I can upload the whole project to see if i'm missing something obvious.

Thanks in advance, Alex.
Coordinator
Feb 7, 2014 at 7:47 PM
Hi Alex,

Do you also have a StatusCode, ErrorCode, and Message on the TwitterQueryException? If it turns out to be a 401 error, which is common when getting started, I have a FAQ to help work through those: https://linqtotwitter.codeplex.com/wikipage?title=LINQ%20to%20Twitter%20FAQ&referringTitle=Documentation

@JoeMayo
Feb 7, 2014 at 8:13 PM
Hi Joe,

So I've just tried:
            try
            {
                await pinAuth.BeginAuthorizeAsync();
            }
            catch (TwitterQueryException tqe)
            {
                MessageBox.Show(tqe.ErrorCode.ToString());
                MessageBox.Show(tqe.StatusCode.ToString());
                MessageBox.Show(tqe.Message);
            }
And i get Error code = 0, StatusCode = NotFound, Message = , So this makes me think something else is wrong.

Any ideas what I'm missing, or would it be easier to look at the project?
Coordinator
Feb 7, 2014 at 9:03 PM
The NotFound, empty exception data, and the Stack Trace from GetRequestTokenAsync (the first endpoint of the OAuth sequence) indicates that it isn't even talking to Twitter.

Are you able to communicate with the Internet through your emulator?
Are you running Fiddler, and possibly don't have it configured properly yet?
Can you run the Linq2TwitterDemos_WindowsPhone sample from the downloadable source code?

It might be useful to make sure the Linq2TwitterDemos_Console sample works for you to iron out any OAuth problems before getting started.

@JoeMayo
Marked as answer by AlexTrott on 2/7/2014 at 1:12 PM
Feb 7, 2014 at 9:12 PM
Oh, my emulator isn't connected to the internet...
I guess when i was working on it earlier and my internet dropped out, that messed up the emulator.
Ah man, now i feel stupid haha, thanks for the help man, all seems good now!
Thanks again!
Jan 7, 2015 at 10:34 AM
Edited Jan 7, 2015 at 11:14 AM
\