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

feat(rbx_auth): check csrf token per request #228

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

blake-mealey
Copy link
Owner

Instead of fetching the CSRF token a single time and caching it in the RobloxAuth struct, we implement a middleware-esque approach where we pass as request factory closure to a custom CsrfTokenStore.send_request function which will call the factory to construct the request, send the request, then extract the CSRF token from the response headers and resend if necessary.

This approach correctly resolves #226 by no longer relying on a deprecated method of receiving a CSRF token.

Additionally, it resolves a long-standing issue of rbx_auth/rbx_api when used in a long-running context where the CSRF token expires. Now, the token will be automatically refreshed and the request retried.

This change does change the public API of both rbx_auth and rbx_api in a very large way, so this PR should not be merged until the docs have been updated as well.

Copy link

vercel bot commented Oct 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mantle-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 20, 2024 10:44pm

@blake-mealey blake-mealey marked this pull request as draft October 20, 2024 22:45
@@ -13,6 +13,14 @@ target:
name: Lightweight Mantle Test
serverFill:
reservedSlots: 4
badges:
Copy link
Owner Author

Choose a reason for hiding this comment

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

Undo this local testing change

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.

Request for CSRF token did not return an X-CSRF-Token header
1 participant