Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have successfully logged in at twitter but after callback it will give me 401 unauthorized error . i have already set callbackurl in twitter application.i have used DotnetOpenAuth for this implemetation. My code:` var accessToken = response.AccessToken; var userId = response.ExtraData["user_id"]; var userName = response.ExtraData["screen_name"];

var profileRequestUrl = new Uri("https://api.twitter.com/1.1/users/show.json?user_id=" + EscapeUriDataStringRfc3986(userId));
var profileEndpoint = new MessageReceivingEndpoint(profileRequestUrl, HttpDeliveryMethods.GetRequest);
var request = WebWorker.PrepareAuthorizedRequest(profileEndpoint, accessToken);

var extraData = new Dictionary<string,> { { "accesstoken", accessToken } };

try
{
using (var profileResponse = request.GetResponse())
{
using (var responseStream = profileResponse.GetResponseStream())
{
var document = xLoadXDocumentFromStream(responseStream);

AddDataIfNotEmpty(extraData, document, "name");
AddDataIfNotEmpty(extraData, document, "location");
AddDataIfNotEmpty(extraData, document, "description");
AddDataIfNotEmpty(extraData, document, "url");
}
}
}
catch
{
// At this point, the authentication is already successful. Here we are just trying to get additional data if we can. If it fails, no problem.
}`

at this point i get error=var profileResponcse=request.getResponce()

i googled but didnt found any solution for this, if any know help me.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900