# `gh auth login` doesn't open the browser, or the code expires

**What you see:** The login page never opens, or GitHub says the one-time code is invalid.

**Why it happens:** The code lasts a few minutes, and some setups can't open the browser on their own.

## How to fix it

1. Ask your agent to run `gh auth login` again.
2. Copy the new code, then open github.com/login/device yourself and paste it.
3. Click **Authorize**, then ask your agent to run `gh auth status`.

## Message for your agent

```text
`gh auth login` didn't work. Run it again with GitHub.com, HTTPS and the web browser option, tell me the code, and wait while I paste it at github.com/login/device.
```

**How to prevent it:** Paste the code right away; it expires quickly.

---
Source: [Agentic Makers](https://agenticmakers.app/en/help/gh-auth-login-problems) · License: CC BY 4.0
