Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

Commented Unassigned: URL Redirect Authorization returning null [2618]

$
0
0
Hello,

trying the code in the documentation for "URL Redirect Authorization", isn't working.
I made a debug and check that when calling:

var applicationCredentials = CredentialsCreator.GenerateApplicationCredentials(consumerKey, consumerSecret);

I see that applicationCredentails is null, therefore the rest of the code works with a null value. Can you help me fix this?

I'm using the last version of tweetinvi (9.8.2), working in Visual Studio 2012 with Framework 4.5. The URL of my application is 127.0.0.1 (localhost but in IP form so Twitter accept it).

Here is the code in the documentation, I'm gettng "null" from applicationCredentials.

// Store the application-only credentials into a variable
var applicationCredentials = CredentialsCreator.GenerateApplicationCredentials(consumerKey, consumerSecret);

// Get the URL that the user needs to visit to accept your application
var url = CredentialsCreator.GetAuthorizationURLForCallback(applicationCredentials, "https://mywebsite.com/twitter_auth");

/ The callbackURL parameter is the entire URL that your controller received
// The URL will be parsed and used to generate the user credentials.
var newCredentials = CredentialsCreator.GetCredentialsFromCallbackURL(callbackURL, applicationCredentials);
Comments: ** Comment from web user: linvi **

If you want to simplify your life, you can download the latest source code of Tweetinvi.

It is as easy as followed :

``` C#
var url = CredentialsCreator.GetAuthorizationURL(new ConsumerCredentials("CONSUMER_KEY", "CONSUMER_SECRET"), "https://YOUR_WEBSITE.COM");
var entireURLAfterCallback = Console.ReadLine();

var newCredentials = CredentialsCreator.GetCredentialsFromCallbackURL(entireURLAfterCallback);
Auth.ExecuteOperationWithCredentials(newCredentials, () => { Console.WriteLine(User.GetLoggedUser()); });
```

Linvi


Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>