-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid unhandled argument null exception for refresh_token grant in token validation when scopes are missing #1409
Comments
What's the intended semantic of a refresh token without any scopes? @RolandGuijt are you able to repro this - do we actually allow the refresh token to be created in the first place? |
@Bartizan, can you describe how the refresh token is getting created in more detail? Is some out of band mechanism inserting this refresh token into the grants store? |
@josephdecock, it seems there is nothing out of band. It's used IRefreshTokenService api for a refresh token creation (or an update). public IEnumerable<string> AuthorizedScopes { get; set; } = default!; It resolves to null by default and ignores nullable warnings in code analysis in VS. Thus it could be unintentionally created/updated with the property equals null (with an empty list it would be fine). class Service
{
Duende.IdentityServer.Services.IRefreshTokenService _refreshTokenService;
async Task CreateSomeRefreshToken()
{
//...
var request = new Duende.IdentityServer.Models.RefreshTokenCreationRequest()
{
AccessToken = my_token,
Subject = my_principal,
Client = my_client,
AuthorizedScopes = my_client.AllowedScopes, // <<<--- fix for v7. The scopes have to be assigned
};
var refresh_token = await _refreshTokenService.CreateRefreshTokenAsync(request);
}
} |
I think that we should rather improve the nullability annotations on the |
I have created an issue in IdentityServer's repo. Please track the issue there from now on. Thanks for reporting this! |
Which version of Duende IdentityServer are you using?
v7.0.6
Which version of .NET are you using?
.net v8
Describe the bug
On call to /connect/token endpoint Identity Server returns an HTML page due to an internal error instead of a response in JSON format.
To Reproduce
Expected behavior
According to OAuth 2 specification the response from the API should be in JSON format.
A token error response is like
Log output/exception with stacktrace
Additional context
Please, revise the necessity of the improvement similar to what we find for authorization_code grant validation, taking into account that the problem occurred due to an error in 3rd party app. after migration from IDS v4.
The text was updated successfully, but these errors were encountered: