LinkedIn 使用 Hammock 时出错

发布于 2024-10-22 23:33:31 字数 1122 浏览 1 评论 0 原文

我正在使用 LinkedIn Hammock ,回调后给出错误 oauth_problem=parameter_absent&oauth_parameters_absent=oauth_verifier

OAuthCredentials credentials = new OAuthCredentials();
        credentials.ConsumerKey = "Consumer key";
        credentials.ConsumerSecret = "Consumer secret";
                credentials.Token = token1;
        credentials.TokenSecret = tokenS;
        string Verifier = Request.QueryString["oauth_verifier"].ToString();
        credentials.Verifier = Verifier
 credentials.Type = OAuthType.AccessToken;
        credentials.ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader;
        credentials.SignatureMethod = OAuthSignatureMethod.HmacSha1;
        credentials.Version = "1.0";


    RestClient client = new RestClient();

    client.Authority = "https://api.linkedin.com/uas/oauth";
    client.Credentials = credentials;
    client.Method = WebMethod.Post;

    RestRequest request = new RestRequest();
    request.Path = "accessToken";

    RestResponse response = client.Request(request);

    string content = response.Content;

    Response.Write(content);

I am using LinkedIn Hammock , after call back it gives error oauth_problem=parameter_absent&oauth_parameters_absent=oauth_verifier

OAuthCredentials credentials = new OAuthCredentials();
        credentials.ConsumerKey = "Consumer key";
        credentials.ConsumerSecret = "Consumer secret";
                credentials.Token = token1;
        credentials.TokenSecret = tokenS;
        string Verifier = Request.QueryString["oauth_verifier"].ToString();
        credentials.Verifier = Verifier
 credentials.Type = OAuthType.AccessToken;
        credentials.ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader;
        credentials.SignatureMethod = OAuthSignatureMethod.HmacSha1;
        credentials.Version = "1.0";


    RestClient client = new RestClient();

    client.Authority = "https://api.linkedin.com/uas/oauth";
    client.Credentials = credentials;
    client.Method = WebMethod.Post;

    RestRequest request = new RestRequest();
    request.Path = "accessToken";

    RestResponse response = client.Request(request);

    string content = response.Content;

    Response.Write(content);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一袭白衣梦中忆 2024-10-29 23:33:31

尝试 request.Path = "/accessToken" 而不是 request.Path = "accessToken" (不带斜线)

Try request.Path = "/accessToken" instead of request.Path = "accessToken" (without slash)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文