C# 400使用DotNetOpenAuth时请求错误
我正在使用DotNetOpenAuth在本地系统中实现OAuth。每次出现以下错误时:+C# 400使用DotNetOpenAuth时请求错误,c#,oauth,https,oauth-2.0,dotnetopenauth,C#,Oauth,Https,Oauth 2.0,Dotnetopenauth,我正在使用DotNetOpenAuth在本地系统中实现OAuth。每次出现以下错误时:+ ex.InnerException {"The remote server returned an error: (400) Bad Request."} System.Exception {System.Net.WebException} 下面是我的代码片段 AuthorizationServerDescription authServer = new AuthorizationServerDe
ex.InnerException {"The remote server returned an error: (400) Bad Request."} System.Exception {System.Net.WebException}
下面是我的代码片段
AuthorizationServerDescription authServer = new AuthorizationServerDescription()
{
TokenEndpoint = new Uri(TOKEN_ENDPOINT),
AuthorizationEndpoint = new Uri(AUTHZ_ENDPOINT),
};
string[] scopes = new string[] { "Scope" };
var client = new WebServerClient(authServer , "ClientId", "Client_Secret");
var token= client.ExchangeUserCredentialForToken("username", "password");
当调用client.ExchangeUserCredentialForToken时,我得到一个错误。不知道发生了什么事。可能的原因是什么?您没有在请求中提供作用域请尝试将其添加到最后一个参数:
client.ExchangeUserCredentialForToken("username", "password", scopes);
您没有在请求中提供作用域。请尝试将其添加到最后一个参数:
client.ExchangeUserCredentialForToken("username", "password", scopes);