# ERR_NGROK_6022 persists after installing the authtoken

TL;DR: the token never actually reached the agent. The classic traps are quoting the token when setting it programmatically, and the token living only in ngrok.yml while the agent reads the environment. Pass it explicitly with `ngrok http 3000 --authtoken [your token]`, no quotes, and the 6022 goes away.

```text
ERR_NGROK_6022
```

## Steps

1. Check for quoting mistakes. If you set the token in code or a notebook, the value must be bare — no surrounding quotes end up in the stored value.

2. Reinstall it cleanly:

```bash
ngrok config add-authtoken [your token]
```

Expected: `Authtoken saved to configuration file`.

3. If the config file is ignored (common in Colab), pass the token on the command line:

```bash
ngrok http 3000 --authtoken [your token]
```

Expected: the tunnel starts and the browser shows your app, not 6022.

## When this applies

- 6022 keeps showing after you already ran add-authtoken
- Colab or notebook setups using pyngrok
- the token works on one machine but not another with the same config file

## When it doesnt

- you never installed a token — do that first
- `ERR_NGROK_4018` — the token is installed but invalid or unverified
- the token was revoked in the dashboard — generate a new one

## Compatibility

ngrok v2/v3 agent, pyngrok in notebooks.

## Other phrasings

- `ngrok 6022 even after installing auth token`
- `ngrok.yml authtoken not working`

## Why it happens

The agent reads the token from a specific precedence chain: flag, env var, config file. A token stored in the wrong place, or stored with stray quote characters, is silently not the token the agent uses.

## Edge cases

- In pyngrok, call the auth setter before connect, and upgrade pyngrok if the setter misbehaves.
- Multiple config files (user vs project) can shadow each other; the flag bypasses all of them.
- Rotating the token in the dashboard invalidates the old value everywhere it was copied.
