Skip to content

Refactor login command to use browser-based magic link request#571

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/update-login-command-flow-one-more-time
Draft

Refactor login command to use browser-based magic link request#571
Copilot wants to merge 2 commits intomainfrom
copilot/update-login-command-flow-one-more-time

Conversation

Copy link
Contributor

Copilot AI commented Dec 4, 2025

Updates the authentication flow to offload the magic link request to the web interface rather than initiating it via the API from the CLI.

Changes

  • Login Command: Replaced the email collection and requestMagicLink API call with a browser redirect using the open package.
  • CLI Interface: Removed the --email flag and updated user prompts to guide the context switch between the terminal and the browser.
  • Tests: Added src/commands/login.test.ts to verify the browser launch and subsequent token exchange flow.

Implementation

// src/commands/login.ts
console.log('We are about to open a browser window for you to log in to Forma...');
await open('https://client.joinforma.com/login?type=magic');

const { id, tk } = promptForEmailedMagicLink();
const accessToken = await exchangeIdAndTkForAccessToken(id, tk);
storeConfig({ accessToken });
Original prompt

Update the login command so that instead of collecting a user's email and pinging it to Forma yo get a magic link, it pops open a browser to https://client.joinforma.com/login?type=magic to enter the email and request the link. The flow afterwards where the user pastes the magic link into the terminal should be the same. Before popping open the browser, explain what is going to happen and that they need to enter their email, get the magic link, and then come back to the terminal to paste.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: timrogers <116134+timrogers@users.noreply.github.com>
Copilot AI changed the title [WIP] Update login command to open browser for magic link Refactor login command to use browser-based magic link request Dec 4, 2025
Copilot AI requested a review from timrogers December 4, 2025 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants