Open
Description
v. 1.51.0
Hi Team, during integration of this library I've found out a contract mismatch between the Error
& Errors
classes and the sample error responses from endpoints like oauth2/token
.
Example error message from fusionAuth service:
{
"error": "invalid_grant",
"error_description": "The user credentials are invalid.",
"error_reason": "invalid_user_credentials"
}
Error.cs
public class Error {
public string code;
public IDictionary<string, object> data;
public string message;
public Error with(Action<Error> action) {
action(this);
return this;
}
}
The DefaultRestClient always return null values as errors:
if (clientResponse.statusCode >= 300)
clientResponse.errorResponse = JsonConvert.DeserializeObject<Errors>(result.Content.ReadAsStringAsync().Result, DefaultRESTClient.SerializerSettings);
Steps to reproduce:
Use the following method with incorrect credentials and try to read the errors:
Task<ClientResponse<AccessToken>> ExchangeUserCredentialsForAccessTokenAsync(
string username,
string password,
string client_id,
string client_secret,
string scope,
string user_code);