openedx / openedx/frontend-platform
MFE JWT cookie not matching MFE user
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 39
- Forks
- 91
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
When an MFE loads, it loads and caches user information from the JWT cookie and displays this information in the header.
If the JWT cookie is later updated via logout/login in another browser tab, as an example, the JWT cookie may exist for a different user than the user cached in the previously loaded MFE. Before using the JWT cookie for an API call, it would be better if the MFE checked that the user_id of the JWT cookie matched the user_id cached in the MFE from load time.
If they mismatch, on option is to simply pop error that states that they can refresh to fix, and skips the API call. This way, the user won't lose data if they were in the middle of something, which would happen if we just refreshed or redirected to the login page, etc.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating where the MFE caches user information during load and where the JWT cookie is read before API calls. Trace those entry points and determine how a mismatched user_id should prevent the call while preserving the user's in-progress data; done means the mismatch is detected and the user receives a refresh instruction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- authentication, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100