DEV-1037: feat(login): migrate to unified auth flow#237
Open
hcarneiro wants to merge 1 commit intoprojects/DEV-908-unified-loginfrom
Open
DEV-1037: feat(login): migrate to unified auth flow#237hcarneiro wants to merge 1 commit intoprojects/DEV-908-unified-loginfrom
hcarneiro wants to merge 1 commit intoprojects/DEV-908-unified-loginfrom
Conversation
Replaces the legacy /v1/auth/third-party endpoint (which is being removed from the API as part of DEV-908) with the same unified sign-in URL the Fliplet Login widget and VS Code extension now use. The allow-list on the API already includes http://localhost:9001/callback so no server-side change is needed for the CLI path. Contract change: the callback URL now receives ?token=<token>&user=... instead of ?auth_token=<token>. Parse the token with url.parse(...).query so we handle any additional params the API may append. Drive-by fixes to the callback handler surfaced while testing: - Multi-org users no longer hard-fail. The previous code rejected any user belonging to more than one organization with "You belong to multiple organizations." Now we pick the first organization by default and print a note telling the user how to switch afterwards via `fliplet list-organizations` + `fliplet organization <id>`. - Every error path now writes an HTTP response to the browser AND calls process.exit(1). The old code left connections hanging, which caused the browser to retry and fire the callback handler twice — leading to the "multiple organizations" error printing twice. package-lock.json: drift from 7.0.0 to 7.0.1 (matches package.json, unrelated to this change). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
/v1/auth/third-partyendpoint with the unified/v1/auth/login?return=callback&callback=http://localhost:9001/callbackcontract?token=<token>(new contract) instead of?auth_token=<token>using proper URL parsingfliplet organization <id>to switchprocess.exit(1)(prevents browser retries that triggered duplicate errors)Test plan
node fliplet-login.js(orfliplet loginif linked) — verify browser opens to unified sign-in page🤖 Generated with Claude Code