Reputation: 5126
I am using DotNetOpenAuth to implement OAuth in my local system. Everytime I am getting the following error : +
ex.InnerException {"The remote server returned an error: (400) Bad Request."} System.Exception {System.Net.WebException}
Below is my code snippet
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");
When client.ExchangeUserCredentialForToken is called then I am getting error. Couldn't figure out what wrong is happening. What can be the potential reason?
Upvotes: 1
Views: 824
Reputation: 514
You are not providing the scopes in your request try out adding it the last parameter:
client.ExchangeUserCredentialForToken("username", "password", scopes);
Upvotes: 0