Call Back Url With Url In A Query String Not Creating Request Token With TweetSharp

238 Views Asked by At

I am trying to send a returnurl query string to the GetRequestToken, but I either get a "?" as the token response, or the "#" gets stripped out on the return callback. When I do get a valid response back, the # and everything after it is stripped out on the returnurl.

var service = new TwitterService(Config.Twitter.ConsumerKey, Config.Twitter.ConsumerSecret);
var requestToken = service.GetRequestToken(HttpUtility.UrlDecode(Request.Url.AbsoluteUri));
var uri = service.GetAuthorizationUri(requestToken);

HttpUtility.UrlDecode(Request.Url.AbsoluteUri)

"https://localhost:44301/twitter/linkaccount?eventid=3762&returnurl=/directors#eventsettings?eventid=3762"

Request.Url.AbsoluteUri

"https://localhost:44301/twitter/linkaccount?eventid=3762&returnurl=%2fdirectors%23eventsettings%3feventid%3d3762"
1

There are 1 best solutions below

0
On BEST ANSWER

Seems like Twitter doesnt like the "#" in the callback url. So I split the left and right parts of it and added that as a query string, then combined them on the result back for the real redirect.

https://localhost:44301/twitter/linkaccount?eventid=3762&leftPart=/directors&rightPart=eventsettings?eventid=3762