# ERR_NGROK_4018: Fix “This ngrok session is not authenticated”

> ERR_NGROK_4018 means ngrok has no authtoken. Save one with ngrok config add-authtoken, or share your app with qURL: no account, authtoken or sign-up at all.

Source: https://layerv.ai/guides/ngrok-err-4018-session-not-authenticated/

---

[← All guides](https://layerv.ai/guides/) 

# ERR\_NGROK\_4018: Fix “This ngrok session is not authenticated”

ERR\_NGROK\_4018 means the ngrok agent started without an authtoken. ngrok requires an account: sign up, copy your authtoken from the dashboard, and save it with ngrok config add-authtoken <token>, or set NGROK\_AUTHTOKEN. To skip the account entirely, publish the app with qURL™: no sign-up, token or API key, and the app stays private with no public URL.

## Why qURL here

qURL never asks for an account, an authtoken or an API key: install the CLI, publish, and send a link, with up to 3 active resources, with links that last up to 24 hours. The app gets no public URL and no open port, so there is nothing for scanners to find. Invite people by email, or send one person a link that opens once, and end access with one command.

[See how qURL compares to ngrok →](https://layerv.ai/compare/qurl-vs-ngrok/)

Copies a prompt for any agent that runs commands. 

## What you need

- The app running on this machine
- For ngrok: an ngrok account and its authtoken
- The qURL CLI 4.0.0 or later
- For qURL: no account, token or API key is needed

Content updated November 23, 2026.

## Where the missing token comes from

__Where the missing token comes from__
| Situation                                   | What fixes ERR\_NGROK\_4018                                                                 | Step   |
| ------------------------------------------- | ------------------------------------------------------------------------------------------- | ------ |
| A new machine or a fresh install            | Sign up, copy the authtoken from the dashboard, and save it with ngrok config add-authtoken | Step 1 |
| A container, CI job or coding agent’s shell | Set the NGROK\_AUTHTOKEN environment variable, which overrides the config file              | Step 2 |
| You would rather not create an account      | Publish the app with qURL instead: nothing to sign up for and no token to store             | Step 3 |

## Steps

1. ### Save your ngrok authtoken once  
ngrok’s error text says it “requires an account and a valid credential to start a session.” Copy the authtoken from the Your Authtoken page of the ngrok dashboard, then save it to the agent’s configuration file so every later run authenticates.  
```  
ngrok config add-authtoken <token>
ngrok http 3000
```

**Check:** ngrok http starts and prints a forwarding URL instead of ERR\_NGROK\_4018.
2. ### In a container, CI job or agent shell, use the environment variable  
A fresh container or sandbox has no ngrok config file, so the token saved on your laptop is not there. The ngrok agent reads NGROK\_AUTHTOKEN, which overrides its config file. Store the token as a secret, not in the repository. ngrok’s agent setup prompt tells the agent to have you configure the authtoken yourself, without pasting it into chat. The agent must wait until that credential is configured.  
```  
export NGROK_AUTHTOKEN=<token>
ngrok http 3000
```
3. ### Or share the app with no account at all  
On macOS, install it with Homebrew. On Linux and Windows, download the package for your platform from the latest release; the CLI page lists each one. For commands with --name, qurl --version must print 4.0.0 or later. Update an older CLI before copying those commands. Nothing asks you to sign up. There is no authtoken to fetch, store or rotate: the first `qurl publish` creates this device’s identity on its own.  
```  
brew install layervai/tap/qurl
brew upgrade qurl
qurl --version
```
4. ### Publish the app and make a link  
`qurl publish` registers the app without giving it a public URL or opening a port, waits until it is serving, prints its CRID and exits, so nothing has to stay open in your terminal. `qurl share` turns the CRID into a link that opens once and expires within 24 hours.  
[Share localhost without signing up →](https://layerv.ai/guides/share-localhost-without-signup/)  
```  
qurl publish http://127.0.0.1:3000 --name "App preview"
qurl share <CRID>
```

## What the recipient sees

A one-time qURL link grants access to the first person who opens it, with no LayerV account or client install.

qURL may show a preview before connection. Named invitees verify their email and save a passkey. Your app’s own login still applies, and your machine must stay awake with the app running.

## Troubleshooting

__Troubleshooting__
| If you see                                               | Do this                                                                                                                                                                                                                                                                                                         |
| -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The authtoken is saved but ERR\_NGROK\_4018 persists     | The agent may be reading another config file, or running as another user, as in a service or container. Pass the token through NGROK\_AUTHTOKEN for that process. With qURL there is no token to misplace: the first qurl publish under each user creates the identity it needs.                                |
| My coding agent stopped and asked for an ngrok authtoken | ngrok’s quick reference for AI agents tells them to ask the user for the authtoken. Give your agent the qURL skill instead: it installs the CLI and publishes the app privately without asking for any account or token. [Share from Claude Code →](https://layerv.ai/guides/share-localhost-from-claude-code/) |

__More troubleshooting__
| If you see                                                                                                                                      | Do this                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| qurl publish says the local app is not accepting TCP connections                                                                                | Start the app first and check that curl works on the same address. qurl publish connects to localhost as 127.0.0.1, so if your app listens only on IPv6 (on macOS or Linux, lsof -iTCP -sTCP:LISTEN -nP shows \[::1\]), publish 'http://\[::1\]:PORT' instead, or start the dev server with --host 127.0.0.1 and publish that address. Neither requires listening on your LAN. Keep the quotes: zsh treats the brackets as a pattern. |
| The recipient sees “Access link invalid”                                                                                                        | The link was already used or has expired. Run qurl share again and send the new link.                                                                                                                                                                                                                                                                                                                                                 |
| The recipient sees “Resource not found”                                                                                                         | The resource was deleted after the link was made. Publish the app again, then run qurl share and send the new link.                                                                                                                                                                                                                                                                                                                   |
| publish rejects http://127.0.0.1 with “only HTTPS URLs are allowed”, asks you to log in, prints no Access: line, or says “unknown flag: --name” | Your qURL CLI is out of date. On macOS run brew update, then brew upgrade qurl; elsewhere install the latest release. After updating, qurl --version prints 4.0.0 or later, and every publish is private by default.                                                                                                                                                                                                                  |
| publish says “a public name is required” in a script or agent run                                                                               | Add --name "App preview" to the publish command, replacing App preview with a short public name for your app. Recipients can see this name; keep secrets and client details out of it.                                                                                                                                                                                                                                                |
| publish says this Linux session “can’t reach a systemd user manager”                                                                            | You are in a container or sandbox without a user service manager. Run qurl publish with --foreground; sharing lasts as long as that process runs. [Container and CI setup →](https://layerv.ai/guides/share-from-a-container-or-ci/)                                                                                                                                                                                                  |
| publish says “Quota Exceeded” with “protected resource limit reached”, or “Your qURL account has reached a plan limit”                          | You can see this without an account: a device with no account can keep up to 3 active resources, with links that last up to 24 hours. Run qurl list --status active, then qurl delete <CRID> for any you no longer need (it asks you to confirm; --yes skips that). qurl stop keeps the resource, so it does not free a slot.                                                                                                         |

## Frequently Asked Questions

Can I use ngrok without an account? 

No. ngrok’s message for ERR\_NGROK\_4018 says it “requires an account and a valid credential to start a session,” and its getting-started steps begin with ngrok config add-authtoken. The qURL CLI publishes with no account: the first qurl publish creates the device identity for you.

Where do I find my ngrok authtoken? 

On the Your Authtoken page of the ngrok dashboard (dashboard.ngrok.com/get-started/your-authtoken). Treat it as a secret: anyone who has it can start endpoints on your account.

Can a coding agent share my app without an account? 

Yes, with qURL. Give the agent the qURL skill (https://layerv.ai/skills/qurl/SKILL.md) and ask it to share the app. It installs the CLI, publishes the app as a private resource, and gives you an address to send. There is no token for it to ask you for.

Who else can reach my app while the link is open? 

Opening the link gives that browser access for 1 hour by default. Other browsers on the same public IP cannot use that session. Whoever opens the link first can use it. Scripts without a browser use IP-based access, which devices on the same public IP can share. Keep your app’s sign-in for sensitive data.

## Related Resources

[qURL vs ngrok →](https://layerv.ai/compare/qurl-vs-ngrok/) [Guide: Switch from ngrok →](https://layerv.ai/guides/switch-from-ngrok/) [Guide: Share localhost without signing up →](https://layerv.ai/guides/share-localhost-without-signup/) [Guide: Get past the ngrok browser warning →](https://layerv.ai/guides/skip-ngrok-browser-warning/) [Guide: Fix ERR\_NGROK\_108, the agent session limit →](https://layerv.ai/guides/ngrok-err-108-simultaneous-agent-sessions/) [An ngrok alternative for headless AI agents →](https://layerv.ai/for-agents/ngrok-alternative-for-headless-agents/) [ngrok alternatives →](https://layerv.ai/compare/ngrok-alternatives/) [ngrok docs: ERR\_NGROK\_4018 ↗](https://ngrok.com/docs/errors/err%5Fngrok%5F4018) [ngrok docs: Get started ↗](https://ngrok.com/docs/getting-started)

## Publish your app now

Install the CLI, then run one command. No sign-up, no API key.

[Install the CLI →](https://layerv.ai/cli/)



---

*This markdown version is auto-generated from [https://layerv.ai/guides/ngrok-err-4018-session-not-authenticated/](https://layerv.ai/guides/ngrok-err-4018-session-not-authenticated/) for AI agents. Curated agent resources: [llms.txt](https://layerv.ai/llms.txt). For the full interactive experience, visit the HTML version.*

Site search: POST https://4f981608-057a-48bb-b205-a289823b32e4.search.ai.cloudflare.com/search with JSON `{"messages":[{"role":"user","content":"YOUR QUERY"}]}`. Results include public content and source URLs.

