Wrong GrantValidationResult error value
I get the wrong error value from GrantValidationResult inside my custom IResourceOwnerPasswordValidator.
Here is the code:
if (roles.Contains(Constants.ROLES_CLIENT))
{
if (!user.PhoneNumberConfirmed)
{
context.Result = new GrantValidationResult(TokenRequestErrors.InvalidRequest, "Phone
number not verified");
return;
}
}
When the token endpoint is called, I get the following:
{
"error": "invalid_grant",
"error_description": "Phone number not verified"
}
I tried all types of TokenRequestErrors but I always get invalid_grant.
I also try to change this value using the following line but it also doesnt work: context.Result.Error = "whatever";
I think I found it, this line shouldn't use OidcConstants.TokenErrors.InvalidGrant but use the resourceOwnerContext.Result.Error
https://github.com/IdentityServer/IdentityServer4/blob/dev/src/IdentityServer4/Validation/TokenRequestValidator.cs#L427
Can I submit a PR?
Yes. Thanks.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.