我正在使用DotNetOpenAuth在我的本地系统中实现OAuth。每次我收到以下错误:+
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时,我收到错误。无法弄清楚发生了什么错误。可能的原因是什么?
答案 0 :(得分:0)
您未在请求中提供范围,请尝试将其添加到最后一个参数:
client.ExchangeUserCredentialForToken("username", "password", scopes);