Reputation: 3
I am receiving the following error: "request token has not been properly authorized by user". The issue lies in the RequestToAccessToken() method.
The following is my code:
private DropNetClient _client;
private UserLogin _userlogin;
private string APP_KEY = "##";
private string APP_SECRET = "##";
private void Dropnet()
{
_client = new DropNetClient(APP_KEY, APP_SECRET);
// Get request token asynchronously
_client.GetTokenAsync(
(userLogin) =>
{
// Authorize app
var tokenUrl = _client.BuildAuthorizeUrl();
RequestToAccessToken();
},
(error) =>
{
MessageBox.Show(error.Response.Content);
});
}
private void RequestToAccessToken()
{
_client.GetAccessTokenAsync(
(userLogin) =>
{
_userlogin = userLogin;
},
(error) =>
{
MessageBox.Show(error.Response.Content);
});
}
Any help would be appreciated, thanks!
Upvotes: 0
Views: 335
Reputation: 8038
The problem is you are not getting the user to login at the url you get back from the _client.BuildAuthorizeUrl()
function.
Once you get a request token you need to get the user to authenticate against that token before getting the access token from that request token.
What platform are you on? Normal process is to show a web view and navigate to that url. Have a look at what the sample project does to get a better idea. https://github.com/DropNet/DropNet/blob/master/DropNet.Samples/DropNet.Samples.WP7/MainPage.xaml.cs#L48
Upvotes: 2