简体   繁体   English

DropNet和身份验证问题

[英]DropNet & Authentication Issues

I am receiving the following error: "request token has not been properly authorized by user". 我收到以下错误:“用户未正确授权请求令牌”。 The issue lies in the RequestToAccessToken() method. 问题出在RequestToAccessToken()方法中。

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! 任何帮助,将不胜感激,谢谢!

The problem is you are not getting the user to login at the url you get back from the _client.BuildAuthorizeUrl() function. 问题是您没有让用户登录从_client.BuildAuthorizeUrl()函数返回的URL。

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. 正常过程是显示Web视图并导航到该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 https://github.com/DropNet/DropNet/blob/master/DropNet.Samples/DropNet.Samples.WP7/MainPage.xaml.cs#L48

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM