DuendeSoftware / IdentityServer

The most flexible and standards-compliant OpenID Connect and OAuth 2.x framework for ASP.NET Core
https://duendesoftware.com/products/identityserver
Other
1.49k stars 344 forks source link

Avoid unhandled argument null exception for refresh_token grant in token validator when scopes missing #1595

Open Bartizan opened 2 months ago

Bartizan commented 2 months ago

What issue does this PR address?

On call to /connect/token endpoint, Identity Server returns an HTML page due to an internal error instead of a response in JSON format. The related issue is created.

Important: Any code or remarks in your Pull Request are under the following terms:

If You provide us with any comments, bug reports, feedback, enhancements, or modifications proposed or suggested by You for the Software, such Feedback is provided on a non-confidential basis (notwithstanding any notice to the contrary You may include in any accompanying communication), and Licensor shall have the right to use such Feedback at its discretion, including, but not limited to the incorporation of such suggested changes into the Software. You hereby grant Licensor a perpetual, irrevocable, transferable, sublicensable, nonexclusive license under all rights necessary to incorporate and use your Feedback for any purpose, including to make and sell any products and services.

(see our license, section 7)

josephdecock commented 1 month ago

Thanks for the PR! I wonder if this is the right place to solve the problem? It seems like creating a refresh token that can't be used ought to be invalid, so maybe we shouldn't even allow the refresh token to be created in the first place.