Problems
I am using
Swashbuckle 5.6.0
for ASP.NET Web Api 2 with OAuth2 token authentication. When I try to authorize a Controller action decorated with[Authorize]
using the red exclamation mark button in SwaggerUI I receive the errorunsupported_grant_type
Another problem seems to be that
SwaggerUI
makes aGET
request to get the token. InPostman
if I send aPOST
request to the token endpoint with the requiredContent-Type
I get a valid token response. If I instead send aGET
request in Postman it doesn't work either, I getunsupported_grant_type
Researched so far
- Googling this error seems to indicate that the request to the Token endpoint needs a
Content-Type "application/x-www-form-urlencoded"
. However, I cannot find any way to set thisContent-Type
in Swashbuckle for token requests (I can set headers successfully for Controller actions usingIOperationFilters
).
Question
So, is there any way through Swashbuckle I can configure SwaggerUI to use POST with a specific Content-Type header when targeting the OAuth2 Token endpoint?