Repository navigation
Hand an existing session to desktop sign-in instead of asking again - #5
Merged
Merged
Conversation
Opening /login?mode=desktop always showed the form, even when the browser was already signed in, because only the access token was kept and the desktop agent needs a refresh token too. Keep the refresh token beside the access token at sign-in (email code and OAuth), and in desktop mode exchange it for a fresh pair and post it to the local agent's callback. Without one, or when the platform refuses it, the form shows as before. Logging out clears it. The desktop hand-off, duplicated in the login and OAuth callback pages, now lives in shared/desktop.ts.
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.
Problem
docent's/login(and the desktop app) open/login?mode=desktop&port=…. Desktop mode always showed the sign-in form, even when the browser was already signed in to the dashboard: only the access token was kept, and the local agent needs a refresh token as well.Change
localStoragebesidetokenat sign-in (email code, Google). Apple returns none, so nothing is kept for it./auth/jwt/refreshfor a fresh pair and post it to the agent's/v1/auth/callback, landing on/redirect?mode=desktop, with no form. With no stored token, or a refused one, the form shows as before.userService.logout) and a failed code entry clear the refresh token.src/app/shared/desktop.ts.Notes
tsc --noEmitpasses; not yet exercised in a browser.Test plan
/loginin docent → no form, docent reports signed in/login→ form shows🤖 Generated with Claude Code