2015-06-04 128 views
1

我正在使用DotNetOpenAuth在本地系統中實現OAuth。每次我收到以下錯誤:+400使用DotNetOpenAuth時的錯誤請求

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

您沒有提供在您的要求嘗試將它的最後一個參數的範圍:

client.ExchangeUserCredentialForToken("username", "password", scopes);