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(server): rework 'revoke all tokens' flow (hattorius) #4717

Merged
merged 6 commits into from
Oct 16, 2023

Conversation

Hattorius
Copy link
Contributor

Description

This pull request introduces a new function that plays a crucial role in the operation of the "revoke all tokens" endpoint. The primary purpose of this function is to efficiently iterate through cached authentication tokens and identify and remove all tokens associated with a specific user ID.

It's worth noting that the solution implemented here differs from the one originally discussed in the related issue. Instead, this approach aligns with the approach detailed in the Discord conversation, ensuring a more effective resolution.

Closes #4684

@monkeytypegeorge monkeytypegeorge added the backend Server stuff label Oct 13, 2023
@Hattorius
Copy link
Contributor Author

Additionally, I'd like to highlight a consideration regarding the function's invocation. There is a potential benefit to removing the await parameter. This change would allow the function to continue iterating through the 20,000 cached tokens while simultaneously providing a response to the user.

By eliminating the await parameter, the function's performance may not see a direct enhancement, but it has the potential to improve the user experience. This way, the system doesn't have to wait for the token removal process to complete before responding to the user, making the operation feel more responsive and user-friendly.

5597666#diff-26fae77e0df373e6d5e5c8c7dc5bac72253613229222ce6e4f96262d62872f2aR901

Copy link
Member

@fehmer fehmer left a comment

Choose a reason for hiding this comment

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

lgtm. simple and clean

backend/src/utils/auth.ts Outdated Show resolved Hide resolved
Miodec
Miodec previously approved these changes Oct 16, 2023
Copy link
Member

@Miodec Miodec left a comment

Choose a reason for hiding this comment

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

Thanks

@Miodec Miodec changed the title fix: Rework 'revoke all tokens' flow fix(server): rework 'revoke all tokens' flow Oct 16, 2023
@Miodec Miodec changed the title fix(server): rework 'revoke all tokens' flow fix(server): rework 'revoke all tokens' flow (hattorius) Oct 16, 2023
@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label Oct 16, 2023
@Miodec Miodec merged commit 3a4d8ef into monkeytypegame:master Oct 16, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Server stuff frontend User interface or web stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rework 'revoke all tokens' flow
5 participants