Repository navigation
fix(auth): clear the stored token when me() rejects it - #264
Merged
Merged
Conversation
Contributor
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/sdk@0.8.54-pr.264.cfcaa05Prefer not to change any import paths? Install using npm alias so your code still imports npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.54-pr.264.cfcaa05"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.8.54-pr.264.cfcaa05"
}
}
Preview published to npm registry — try new features instantly! |
added 2 commits
August 27, 2026 10:52
guyofeck
reviewed
Oct 20, 2026
guyofeck
self-requested a review
October 20, 2026 10:14
guyofeck
approved these changes
Oct 20, 2026
redirectToLogin() cleared storage on every call, so a valid session was lost on a transient me() failure (requiresAuth treats any error as signed out), a "Sign in" click while signed in, or an abandoned login. Clear instead when me() gets a 401 and storage still holds the token it sent, the same rule as the server-side script this replaces. A token stored mid-flight is kept. Task: https://b44sync.base44.app/rd-hub/tasks/BASE-12635 Task file: https://github.com/base44-dev/suss-tasks/blob/7bad58778ebc784b3e49b15fb4faee1016a9384f/apper/retire_clear_token_script/land_sdk_264.md agent: sdk.264
guyofeck
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A rejected token left in
localStorageboots the next page with it. Apps that serve their own login page then get another 401 and redirect to/loginforever: the loop that hit ~3k custom-auth apps when the legacy app-user signing key was cut off (https://base44workspace.slack.com/archives/C095K108GKU/p1787509962872049).me()now clears the stored token when it answers 401 and storage still holds the token the request sent. Any other failure (5xx, 429, network) keeps it, and so does a token stored while the request was in flight (a login in this or another tab).redirectToLogin()no longer touches storage, so a valid session survives a "Sign in" click or an abandoned login.This is the same rule as the script base44-dev/apper#21743 injects into served apps; once apps pick this SDK up on their next build/publish, that script can be retired.