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

New Post: 401 Not Authorized Exception when calling GetCredentialsFromVerifierCode

$
0
0
Again async :p

I can see what is wrong with your code.
As I tried to described previously, calling GetAuthorizationURL results in the applicationCredentials to have its AuthorizationToken value to be set.
In the second method you are creating a new ApplicationCredentials which will not be linked to the previous URL because the AuthorizationKey won't be set.

What you need to do is to store the information of the AuthorizationKey and AuthorizationSecret in your Session and set them back when the second method is invoked.
// In GenerateAuthorisationRequest after the call to GetAuthorizationURL
Session["AuthorizationKey"] = applicationCredentials.AuthorizationKey;
Session["AuthorizationSecret"] = applicationCredentials.AuthorizationSecret;

// In ConfirmAuthorisationRequest right after creating the applicationCredentials
applicationCredentials.AuthorizationKey = Session["AuthorizationKey"];
applicationCredentials.AuthorizationSecret = Session["AuthorizationSecret"];
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>