Install › Cloudflare sign-in and tunnel

Cloudflare sign-in and tunnel

About 5 minutes, one time5 min read

You do a few clicks in Cloudflare once. The installer does the rest through the Cloudflare API: the tunnel, the web address and the sign-in.

On this page
  1. The short version
  2. What you do in Cloudflare
  3. What the installer sets up
  4. How people sign in
  5. Key-only routes for AI apps
  6. When something goes wrong

The short version

  • You click: put the domain on Cloudflare, switch on Zero Trust (Free plan) and create one API token with seven permissions.
  • The installer builds: a tunnel your server dials out on, the DNS record, and a Cloudflare Access sign-in that lets in only the emails you list.
  • One login: the app checks Cloudflare's signed token, so people sign in once, at the Cloudflare door.
  • AI apps get a narrow side door: a short list of API and MCP routes accept an Operation Kit key instead of the Cloudflare sign-in. Admin and secrets routes never do.

What you do in Cloudflare

  1. Put the domain on Cloudflare

    Your domain (for example yourcompany.com) must show as Active under Websites. If you are adding it now, use the Free plan and check that the copied DNS records are complete, especially MX, or email stops working.

  2. Switch on Zero Trust

    Open Zero Trust from the left menu. The first time, pick a team name (any name, for example yourcompany) and the Free plan. Cloudflare may ask for a card even for the Free plan.

  3. Create the API token

    Go to My Profile → API Tokens → Create Token → Custom token, add the seven permissions below, and limit it to your domain (Zone Resources) and your account (Account Resources).

TypePermissionAccess
ZoneZoneRead
ZoneDNSEdit
AccountCloudflare TunnelEdit
AccountAccess: Apps and PoliciesEdit
AccountAccess: Organizations, Identity Providers, and GroupsEdit
AccountAccess: Service TokensEdit
ZoneConfig RulesEdit

All seven matter. The one most often missed is Access: Organizations, Identity Providers, and Groups. Without Config Rules, the step that lets AI apps through stops and changes nothing.

Keep it secret

Keep the token in an environment variable on your laptop (export CF_API_TOKEN=...) or type it in hidden on the server. Never paste it into a chat. The installer moves it into the root-only secrets folder.

Nothing else needs copying out of Cloudflare. The installer finds your account from the domain.

What the installer sets up

The tunnelA cloudflared container on your server dials out to Cloudflare. The app listens only on private addresses (127.0.0.1 and the Docker bridge), never on the public network card. The firewall keeps ports 80 and 443 closed.
The addressA DNS record for your DOMAIN that points at the tunnel.
The Access appOnly the addresses in ACCESS_ALLOWED_EMAILS and/or everyone at ACCESS_ALLOWED_EMAIL_DOMAIN get through. A sign-in lasts 24 hours by default (ACCESS_SESSION_DURATION).
One loginThe installer stores your Zero Trust team and the Access app's ID on the server, which switches on one login (below).
Key-only routesA second, path-limited Access app for AI apps and scripts (below).
One Configuration RuleTurns off Browser Integrity Check for your Operation Kit address under /api/ only, so apps with a valid key don't get Cloudflare error 1010. Your other rules and hostnames are not touched.

How people sign in

Choose the method with ACCESS_LOGIN_METHOD in client.conf:

SettingHow it works
otp (default)Cloudflare emails a one-time code to an allowed address. Works on every install with nothing else to set up.
googleSign in with Google. Needs an OAuth app in Google Cloud, with its client ID and secret handed over at install.
microsoftSign in with Microsoft. Needs an app in Microsoft Entra, with its IDs and secret handed over at install.

One login. After someone passes the Cloudflare door, Cloudflare adds a signed token to every request. The app checks the signature, that it was issued for your Access app and your team, and that it hasn't expired. Only then does it read the email, and the email must belong to exactly one Operation Kit user. Nobody is ever given an account automatically: an allowed email with no user gets a "No account for this email" page. Signing out of the app signs the person out of Cloudflare Access too.

A username and password still work as a break-glass way in. They have no built-in two-factor; two-factor comes from your Cloudflare sign-in method.

Key-only routes for AI apps

Cloudflare Access sits in front of the whole site. An AI app or script calling Operation Kit sends only its Operation Kit key, which Cloudflare doesn't understand, so it gets a sign-in page. With API_KEY_AUTH_BYPASS="on" (the default) the installer adds a second Access app called Operation Kit API (key auth) that steps aside on a short list of routes, so the key is the check.

  • The list is narrow. It covers the routes AI apps use, such as /api/mcp, the board, the knowledge base and the bot list, each listed one by one. It is kept in install/api-bypass-paths.conf. There is no blanket /api/*.
  • The key still decides. Without a valid key those routes answer 401. Each key is limited to the workspaces and abilities you chose when you made it in Settings → API & MCP.
  • Operator routes keep both locks. Admin, secrets, internal, webhook and sign-in routes are never on the list, and the installer refuses to add them.

Set API_KEY_AUTH_BYPASS="off" only if no AI app or script will ever call your install. Connecting apps step by step: Use bots from other AI apps.

When something goes wrong

You seeWhat to do
"cannot read the Zero Trust organization"The token lacks Access: Organizations, Identity Providers, and Groups → Edit. Edit the token and re-run the installer.
"cannot write Configuration Rules"Add Zone → Config Rules → Edit to the token and re-run.
"Zero Trust is not switched on for this account yet"Open Zero Trust once, pick a team name and the Free plan.
An AI app gets a Cloudflare sign-in page or error 1010Check API_KEY_AUTH_BYPASS and API_BROWSER_INTEGRITY_EXCEPTION are "on", then see CLOUDFLARE-API-ACCESS.md.

Rule of thumb: Operation Kit always answers in JSON, Cloudflare never does. A JSON 401 means the app saw the request and the key was missing or wrong.

Last checked against Operation Kit main (f504a64), 11 Nov 2026Suggest an edit