---
title: "gh auth login and aws sso login open the wrong browser profile · Profile Porter"
description: "Why sign-in links from gh auth login, aws sso login and other command-line tools open in the wrong browser profile, and how to send them to the profile where you&#x27;re signed in."
url: "https://profileporter.com/how-to/terminal-sign-in-links-wrong-profile/"
---

How to

# gh auth login opens the wrong browser profile? Fix the sign-in link

Updated 18 November 2026

You run `gh auth login` or `aws sso login`, the browser opens, and you're in the wrong profile: signed in to your personal GitHub, or to no AWS account at all. The tool only asks your computer to open a link. Here's how to make it open in the right profile.

On this page

1. [Why the sign-in page opens in the wrong profile](https://profileporter.com/how-to/terminal-sign-in-links-wrong-profile/#why)
2. [Any tool: open the link yourself](https://profileporter.com/how-to/terminal-sign-in-links-wrong-profile/#copy)
3. [GitHub CLI: choose the browser with GH\_BROWSER](https://profileporter.com/how-to/terminal-sign-in-links-wrong-profile/#gh)
4. [Every tool: open sign-in links where you're signed in](https://profileporter.com/how-to/terminal-sign-in-links-wrong-profile/#porter)

## Why the sign-in page opens in the wrong profile

Command-line tools open their sign-in page in your default browser. The browser then picks the profile whose window you used last. If that's your personal profile, you approve the work tool with your personal account, or you have to sign in from scratch.

It's worse with several clients or AWS organizations, one profile each: the link has no idea which one you meant.

## Any tool: open the link yourself

Most tools print the link as well as opening it. Close the wrong tab, copy the link from the terminal, and paste it into a window of the right profile. For `aws sso login`, stop the browser from opening at all:

```
aws sso login --profile acme-prod --no-browser
```

It prints the link to open. The sign-in finishes on your own computer, so it works from any profile.

## GitHub CLI: choose the browser with GH\_BROWSER

`gh` reads `GH_BROWSER` (or `BROWSER`) for the browser to open links in, and adds the link to the end of that command. To send its links to one Chrome profile on a Mac:

```
export GH_BROWSER='open -na "Google Chrome" --args --profile-directory="Profile 1"'
```

Find the profile's folder name, here `Profile 1`, in `chrome://version` under **Profile Path**. Put the line in your shell's startup file to keep it. This is one profile for every `gh` link, so it doesn't help if you switch between GitHub accounts.

## Every tool: open sign-in links where you're signed in

[Profile Porter](https://profileporter.com/) treats sign-in links as a case of their own. When a tool's link starts a sign-in, such as GitHub's device page or an AWS, Google or Microsoft sign-in, it opens in the profile that's signed in to that provider.

- If no profile is signed in, it asks rather than guess, and remembers your pick for sign-ins from that app.
- If you were on the site in the last 15 minutes, the link goes to that profile.
- No setup per tool: it looks at the link itself, so `gh`, `aws` and other tools that open a sign-in page are covered alike.

It reads where you're signed in from your browsers, on your computer, in Chrome, Edge, Brave, Arc, Firefox and Safari profiles.

Get Profile Porter for €12, once.

Everything included, no account, and a full refund within 14 days if it isn't for you. macOS 14 or later; on Windows 10 and 11, [get it from the Microsoft Store](https://apps.microsoft.com/detail/9N5C3B974DL2).

[Download](https://profileporter.com/download/)

## Related

- [Claude Code or Codex login opens the wrong browser profile](https://profileporter.com/how-to/claude-code-codex-login-wrong-browser-profile/)
- [Google Cloud console opens in the wrong account](https://profileporter.com/how-to/google-cloud-console-wrong-account/)
- [How to open links in a specific Chrome profile](https://profileporter.com/how-to/open-links-in-chrome-profile/)
- [How to open links in a specific Firefox profile](https://profileporter.com/how-to/firefox-open-links-in-profile/)
- [Every feature: sign-in links](https://profileporter.com/docs/#sign-in-links)
