I downloaded the katana project and wanted to try the client/server in the sandbox project.
I rand into a problem at for OAuthValidateClientAuthenticationContext :
public bool TryGetFormCredentials(out string clientId, out string clientSecret)
{
clientId = Parameters.Get(Constants.Parameters.ClientId);
if (!String.IsNullOrEmpty(clientId))
{
clientSecret = Parameters.Get(Constants.Parameters.ClientSecret);
ClientId = clientId;
return true;
}
clientId = null;
clientSecret = null;
return false;
}
clientSecret is null and hence the following do not validated the client.
private Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
{
string clientId;
string clientSecret;
if (context.TryGetBasicCredentials(out clientId, out clientSecret) ||
context.TryGetFormCredentials(out clientId, out clientSecret))
{
if (clientId == "123456" && clientSecret == "abcdef")
{
context.Validated();
}
else if (context.ClientId == "7890ab" && clientSecret == "7890ab")
{
context.Validated();
}
}
return Task.FromResult(0);
}
Ensure the client_secret param doesn't contain a space in your post
client_secret[space] will fail.