使用Hammock库进行Linkedin访问会导致“oauth expires in = 0”错误

时间:2012-02-08 10:24:53

标签: c# windows-phone-7 linkedin hammock

我在我的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));

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

             _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));
    }

1 个答案:

答案 0 :(得分:0)

当令牌在" 0"中到期时,表示令牌无限期,或者直到用户取消授权。继续使用该令牌进行OAuth调用,它将对您有用。