Reputation: 18361
I'm struggling a bit to figure out how to use Trello's OAuth API calls from my Windows Phone 7 app. The API isn't really documented, aside from a listing of the endpoints.
Here's what I have so far:
public void OnAuthenticateClicked(object sender, EventArgs e)
{
const string consumerKey = "mykey";
const string consumerSecret = "mysecret";
const string baseUrl = "https://trello.com/1";
var client = new RestClient(baseUrl)
{
Authenticator = OAuth1Authenticator.ForRequestToken(consumerKey, consumerSecret)
};
var request = new RestRequest("OAuthGetRequestToken", Method.POST);
var response = client.ExecuteAsync(request, HandleResponse);
}
private void HandleResponse(IRestResponse restResponse)
{
var response = restResponse;
Console.Write(response.StatusCode);
}
I'm getting a 404
response, so something's not right, obviously.
Any suggestions?
Upvotes: 4
Views: 975
Reputation: 21
I think your base url is incorrect. Please try the following:
const string baseUrl = "https://api.trello.com/1";
Upvotes: 2
Reputation: 51091
Not using the ExecuteAsync
seems to make it work:
RestRequest request = new RestRequest("OAuthGetRequestToken", Method.POST);
IRestResponse response = client.Execute(request);
Console.Write(response.StatusCode);
At one point "oAuth1 is not yet supported in async scenarios (SL and WP)", according to this post by John Sheehan.
Upvotes: 3