Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Respect explicitly passed scopes on refresh #43

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

hybrid2102
Copy link

Scope mapping was missing when preparing Request for RefreshAccessTokenAsync

@brockallen
Copy link
Member

Can you elaborate and explain more what you felt wasn't working correctly that prompted this change?

@hybrid2102
Copy link
Author

I apologize for not providing more details from the beginning.

In my Blazor Server application (.NET 7) I utilize this library, and I’ve observed that when the token is automatically refreshed, the scopes are not included in the request (unlike the initial token request). To address this, I attempted to pass the scopes manually using the following code snippet:

var token = await _tokenManagementService.GetAccessTokenAsync(user, new UserTokenRequestParameters { Scope = scope });

Unfortunately, it appears that the Scope parameter is not mapped in the RefreshAccessTokenAsync method.

As a result, I added the necessary mapping and submitted a Pull Request.

Is there perhaps a better way to pass the scopes in the token refresh request or instruct the library to reuse the scopes from the original request?

Copy link
Member

@josephdecock josephdecock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I'm not going to add test coverage to this, because our tests are all integration tests against an identity server instance, and that doesn't use this parameter on refresh.

@josephdecock josephdecock added this to the 2.1.0 milestone Nov 27, 2023
@josephdecock josephdecock merged commit c2aa94b into DuendeSoftware:main Nov 27, 2023
5 checks passed
@josephdecock
Copy link
Member

Thanks @hybrid2102! This will go out in our next release, and you should see a preview of that this week!

@josephdecock josephdecock changed the title added Scope mapping in RefreshAccessTokenAsync Respect explicitly passed scopes on refresh Nov 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants