Reputation: 4769
I am attempting to get a user authorization token with the following:
public static void RequestAuthorization(WebConsumer consumer)
{
if (consumer == null) throw new ArgumentNullException("consumer");
Uri callback = new Uri("http://www.ihighfive.com/"); //test url until app is external
var extraParams = new Dictionary<string, string> {
//need to pass this as extra, but leave the value blank
{ "oauth_token", string.Empty}
};
var req = consumer.PrepareRequestUserAuthorization(callback, extraParams, null);
consumer.Channel.Send(req);
}
But I receive back an error:
{ "error": { "message" : "oauth_callback is required", "isFriendly" : false} }
If I modify the above code and manually include the oauth_callback paramater I get more favorable results
var extraParams = new Dictionary<string, string> {
//need to pass this as extra, but leave the value blank
{ "oauth_token", string.Empty},
{ "oauth_callback", "http://www.ihighfive.com/" },
};
So passing the callback argument to .PrepareRequestUserAuthorization() seems to not be including oauth_callback with the request. Am I somehow using the callback parameter incorrectly?
--edit--
Further investigation shows that the oauth_callback parameter is not getting included if the ServiceProviderDescription is set to ProtocolVersion.V10. If it is either set to ProtocolVersion.V10a, or not set at all, the oauth_callback gets included in the request.
Upvotes: 2
Views: 1402
Reputation: 81791
If your question is then, "why isn't oauth_callback being included automatically", your further investigation is the answer. It's a new parameter added in OAuth 1.0a, so when you set the version to 1.0, the parameter is omitted.
Upvotes: 3