37signals DotNetOpenAuth ProcessUserAuthorization总是返回错误的请求(400)

时间:2016-01-06 07:09:10

标签: dotnetopenauth 37-signals

我尝试使用DotNetOpenAuth从37Signals获取令牌但是geeting 400(错误请求)可以帮助我。下面是代码

[Route("basecamp1")]
public ActionResult Basecamp1()
{
    var server = new DotNetOpenAuth.OAuth2.AuthorizationServerDescription();
    server.AuthorizationEndpoint = new Uri("basecamp authorization URL");
    server.TokenEndpoint = new Uri("basecamp Token URL");

    var client = new DotNetOpenAuth.OAuth2.WebServerClient(
        server, "clientid", "clientsecret");

    client.RequestUserAuthorization(returnTo: new Uri("http://localhost:2263/company/settings/basecampauth"));
    Response.End();

    return null;
}

[Route("basecampauth")]
public void BasecampAuth(string code, string state)
{
    var server = new DotNetOpenAuth.OAuth2.AuthorizationServerDescription();
    server.AuthorizationEndpoint = new Uri("basecamp authorization URL");
    server.TokenEndpoint = new new Uri("basecamp Token URL");


    var client = new DotNetOpenAuth.OAuth2.WebServerClient(
        server, "4179c03d1aea7c4d18234d3f70b4f6d4206b33e5", "f4b0b6e837bd67676f4a2432ec295be2031cecc1");

    var data = client.ProcessUserAuthorization();
    Response.Write(data.AccessToken);
    Response.End();
}

异常详细信息:System.Net.WebException:远程服务器返回错误:(400)错误请求。

0 个答案:

没有答案