I have an endPoint service with the following prototype:
async Task<IActionResult> Exchange(OpenIddictRequest openIdRequest)
I send a postMan request like below:
As you can see, I'm sending 4 parameters, and particulary I provide parameter grant_type with value password. But when I check the parameters in the back-end I just get 3 parameters like below:
When I check with openIdRequest.IsPasswordGrantType()
method it returns false
.
If I add a new parameter with name grantType and value password I get 4 paramters and the method openIdRequest.IsPasswordGrantType()
returns true. You can see it in the following images:
And in the backend:
If I replace the parameter grant_type with parameter grantType I get this error:
openiddict the mandatory 'grant_type' parameter is missing
can anyone guide me please? (I'm using OpenIddict: version 3.1.1 and .net 6)
I found the problem. I changed the Exchange Method prototype from :
Task<IActionResult> Exchange(OpenIddictRequest openIdRequest)
to:
Task<IActionResult> Exchange()
and got the openIdRequest from HttpContext like below:
var openIdRequest = HttpContext.GetOpenIddictServerRequest();
Now I can see all of those parameters in my openIdRequest.