1

我在我的 Windows 移动应用程序中使用了吊床库来访问Linkedin 。我修改了 twitter Hammock 库以进行链接访问。在访问令牌之后,它说明了这一点。

“oauth_token=538e6cce-7fb4-40f7-baab-1a1dc73af28d&oauth_token_secret=8cc5c61b-aca1-44ba-b1c3-9b55f1945b9c&oauth_expires_in=0&oauth_authorization_expires_in=0”

在这里,在访问令牌步骤中,我注意到"oauth expires in = 0".

那么,这是因为 oauth 库的问题吗?我搜索了很多网站并尝试了很多。

在下面的代码之后我得到了这个错误。

          var client = new RestClient
        {
            Authority = "https://api.linkedin.com/uas/oauth",
            Credentials = credentials,
            HasElevatedPermissions = true
        };

        var request = new RestRequest
        {
            Path = "/accessToken",
            Credentials = credentials
        };
        client.BeginRequest(request, new RestCallback(RequestAccessTokenCompleted));

获得该访问令牌后,我获得了linkedin登录页面以进行授权。我想在链接共享中发布一个链接。当我给出 post 方法时,我在以下代码中出现错误。我为此修改了 twitter 库。请指导我..

             _client = new RestClient
        {
            Authority = "http://api.linkedin.com/v1",
            Credentials = _credentials,
            HasElevatedPermissions = true,
          // Method = WebMethod.Post
        };
    }

    public void NewTweet(string tweetText)
    {
        if (!_authorized)
        {
            if (ErrorEvent != null)
                ErrorEvent(this, EventArgs.Empty);
            return;
        }

        var request = new RestRequest
        {
            Credentials = _credentials,
            Path = "/people/~/shares",
            Method = WebMethod.Post
        };

       // _client.AddHeader("Content-Type", tweetText);
        _client.AddParameter("Content-Type", tweetText);

        _client.BeginRequest(request, new RestCallback(NewTweetCompleted));
    }
4

1 回答 1

0

当令牌过期为“0”时,表示令牌无限期有效,或者直到用户取消授权为止。继续使用该令牌进行 OAuth 调用,它将为您工作。

于 2012-02-10T18:03:19.787 回答