Logging in with a non-default browser from the terminal

Nafis Fuad Name

Nafis Fuad


Wednesday, July 6, 2022

2 min read

Let’s say you want to login to your work account with the vercel CLI, but you use a different browser for work. Now the CLI would open the personal browser by default and voila, you’re now logged into your personal account. So what do you do?

cover image

It’s a common problem. You want to login to your work account with the vercel CLI, and you use a different browser for work all the time (easy to have everything logged in there). I personally use Google Chrome for my day-to-day personal use and Firefox for work. I have been suggested to use the profile switching options offered by most browsers these days, but for some reason they’re not as smooth as having two different browsers - easy mental model as well.

Back from the detour, whenever I’d want to log in to any CLI service (be it Vercel, GitHub or otherwise) I’d have to spend quite some time to login to the right account (with hacky ways of course.)

TIL there’s a better approach to this one. Using the out-of-band mode. Most CLIs offer something similar. This one’s from Vercel docs for example:

As written there, when doing this, one gets the verification link right in the terminal and then it’s up to the users to put the link in whichever browser they want. Maybe this should’ve been the default for all CLIs, because afaik every single “developer” has got both work and a personal profile. Or depending on projects, might have different accounts for different ones. Regardless, still good that this out-of-band mode exists, or else life would continue to suck.

Subscribe to Saturday Already!💌

Where should I send you all the free goodies?

No fluff. No spam. Unsubscribe any time.

    Every Saturday I share some high-quality insights from across the web, directly to you. Here's what you can expect:

  • Actionable productivity tips, some practical life lessons from my own mistakes, insights from the tech industry, and more.
  • Early previews of new products, services, resources etc. that I try out or that I've been working on myself.
  • Some great articles / books / videos / podcasts curated through a rigid filtration process over the past few years

Made with ❤️ and these tech.

Please don't copy me. 🙏