Repository navigation
fix(auth): keep the browser login listening for 5 minutes - #5
Open
ishaanxgupta wants to merge 2 commits into
Open
ishaanxgupta wants to merge 2 commits into
ishaanxgupta wants to merge 2 commits into
Conversation
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.
First-run sign-in ran
startAuthFlowinside the SessionStart hook with a 25s budget (AUTH_TIMEOUT = 25000). When the hook returned, the callback listener on port 19881 closed, so anyone who spent more than 25s on the consent page landed on a dead redirect.This ports the Claude Code fix (claude-supermemory #155) as-is:
startBackgroundAuth(config, waitMs)spawns a detachedhooks/auth-server.js <apiBaseUrl> <resource>. It runsstartAuthFlowforAUTH_WAIT_MS(5 minutes) with{ background: true }.withAuthLockrecords{pid, background}. A newer login stops a waiting background one viastopBackgroundLogininstead of failing on a busy port.package.jsonand.muse-plugin/plugin.jsonto 0.3.0.Testing
node --test test/unit.mjs: 9/9 pass. New tests run against a mock OAuth server. In one, consent approved after the hook stopped waiting still saves credentials, andgetAccessTokenreturns the new token. In the other, an unreachable issuer gives AUTH_FAILED.HOME, with anopenshim that records the URL:cwdin a repo whose container has memories:◪ supermemory · 5 memories loaded for mono.auth.js logoutand disconnected in the console.auth.js loginsent SIGTERM to a waiting backgroundauth-server.js, took the lock, and completed.