Reputation: 179
Im having the following problem connecting to Twitter using OAuth PIN authorizer method.
The Code:
private async void button1_Click(object sender, RoutedEventArgs e)
{
pinAuth = new PinAuthorizer
{
CredentialStore = new InMemoryCredentialStore
{
ConsumerKey = resourceLoader.GetString("ConsumerKey"),
ConsumerSecret = resourceLoader.GetString("ConsumerSecret")
},
GoToTwitterAuthorization = async pageLink =>
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
() =>{ OAuthWebBrowser.Navigate(new Uri(pageLink, UriKind.Absolute)); })
};
await pinAuth.BeginAuthorizeAsync();
After retrieving the PIN I would do something like that:
private async void button2_Click(object sender, RoutedEventArgs e)
{
string pin = null; // Cant get the PIN
await pinAuth.CompleteAuthorizeAsync(pin);
var credentials = pinAuth.CredentialStore;
string oauthToken = credentials.OAuthToken;
string oauthTokenSecret = credentials.OAuthTokenSecret;
string screenName = credentials.ScreenName;
ulong userID = credentials.UserID;
}
The browser opens I put my credentials into the form and click authorize. After this click the PIN pops up for half a second and then the following error message appears: "This page requires some information that was not provided. Please return to the site that sent you to this page and try again... it was probably an honest mistake"
Same problem in this Thread without solution so far.
Thank you!
//UPDATE
Upvotes: 0
Views: 275
Reputation: 2087
With no response in soon 3 days I allow myself to give you an alternative example with Tweetinvi (which I am the developer). I understand that you are trying to use LinqToTwitter and I don't know the library enough to help you with this specific problem.
You can find more information regarding authentication in the associated wiki section.
// Create a new set of credentials for the application.
var appCredentials = new TwitterCredentials("CONSUMER_KEY", "CONSUMER_SECRET");
// Init the authentication process and store the related `AuthenticationContext`.
var authenticationContext = AuthFlow.InitAuthentication(appCredentials);
// Go to the URL so that Twitter authenticates the user and gives him a PIN code.
Process.Start(authenticationContext.AuthorizationURL);
// Ask the user to enter the pin code given by Twitter
var pinCode = Console.ReadLine();
// With this pin code it is now possible to get the credentials back from Twitter
var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pinCode, authenticationContext);
// Use the user credentials in your application
Auth.SetCredentials(userCredentials);
I hope this could be of any help for you.
Upvotes: 1