【问题标题】:Exception when using DropNet API使用 DropNet API 时出现异常
【发布时间】:2014-03-15 22:05:09
【问题描述】:

我做了很多研究,但找不到解决问题的方法。我正在使用 dropNet API 构建一个保管箱客户端,但是在尝试获取访问令牌时出现异常。

这是我的代码:

        var client = new DropNetClient("KEY", "SECRET");
        client.GetToken();
        var url = client.BuildAuthorizeUrl();
        Uri targetUri = new Uri(url);
        webBrowser.Navigate(targetUri);

        //the exception raise here because i call the getAccessToken too early
        var accessToken = client.GetAccessToken();

我知道我必须将用户重定向到网络浏览器,以便他可以授权应用程序,然后我应该调用 getAccessToken(),问题是如果有人可以帮助我,我不知道该怎么做...

谢谢

【问题讨论】:

    标签: c# .net visual-studio-2010 oauth dropnet


    【解决方案1】:

    最简单的方法是给 BuildUrl 函数一个回调 URL,然后监听浏览器控件导航事件,直到它到达那个 URL。然后你想调用 GetAccessToken。

    Github 存储库中有一个示例 Windows Phone 项目,它展示了如何执行此操作。 https://github.com/dkarzon/DropNet/blob/master/DropNet.Samples/DropNet.Samples.WP7/MainPage.xaml.cs#L63

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-06
      • 2011-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-07
      • 2021-10-16
      相关资源
      最近更新 更多