Skip to content
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

fix(refresh-session): forceRefreshSession does not reset storageSilentRenewRunning #1943

Merged

Conversation

Yberion
Copy link
Contributor

@Yberion Yberion commented May 17, 2024

Hello,

This PR fixes #1942.

@@ -143,6 +164,7 @@ export class RefreshSessionService {
`forceRefreshSession timeout. Attempt #${currentAttempt}`
);

// Still needed ?
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@Yberion Yberion May 17, 2024

Choose a reason for hiding this comment

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

Now that you ask me and after thinking a bit more, as forceRefreshSession returns an Observable, this is indeed useless to create those new events, as we can achieve the same right now.

I will remove the new events.

On why I put resetSilentRenewRunning line 95 in a finalize (tap when I'll remove the events), it's because I prefer to not duplicate logic, that's why I was wondering if the one line 167 was still needed, but I think it's not anymore.

But both are fine for me, as it will fix the issue anyway.

Any "preference"?

Copy link
Contributor Author

@Yberion Yberion May 17, 2024

Choose a reason for hiding this comment

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

Looking a bit more, I think, if we hit this line https://github.com/damienbod/angular-auth-oidc-client/blob/main/projects/angular-auth-oidc-client/src/lib/callback/refresh-session.service.ts#L138, we will face the same problem, not being able to re-use forceRefreshSession as resetSilentRenewRunning will not be called.

And resetSilentRenewRunning line 138 is only being called when there's the timeout and it retry, if there's no error, resetSilentRenewRunning seems not to be called, meaning we'll also face the problem.

Putting it on this.forceRefreshSession will probably fixes the issue in all cases.

Copy link
Contributor

@timdeschryver timdeschryver left a comment

Choose a reason for hiding this comment

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

From my point of view this change looks good 👍
Side note: if you force the refresh token very rapidly (when a request is already pending) then this results in an error "0-angularCodeRefreshTokens - no refresh token found, please login", but I think this behavior was already there and isn't caused by this change.

@FabianGosebrink FabianGosebrink merged commit 33372ed into damienbod:main May 26, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: forceRefreshSession does not reset storageSilentRenewRunning
3 participants