---
title: "Restrict an app to people in your company: the while.sh docs"
url: https://while.sh/en/docs/building-blocks/internal-access/
updated: 2026-11-09
---

# Internal access

An app that only the people in your organization open, with their usual account. Your app receives their identity, with no sign-in page to code.

> You, to your agent: Restrict the app to people in the company.

## What your agent writes

Your agent writes it in while.yaml, at the root of your app:

```yaml titre="while.yaml"
services:
  - name: web
    port: 3000
    access: internal
    groups: [accounting, management]
    email_domains: [example.com]
```

## When to use it

For an app intended for the organization's people: they come in with their account, and nothing is open to the Internet.

## How it works

An `access: internal` service only opens after signing in, with a while account or through the organization's enterprise connection. The app receives the person's identity, without authentication to code.

People who only use your internal apps do not have to become members: do not invite them, and give them no role. The enterprise connection and `access: internal`, with `email_domains` or groups, are enough (without an enterprise connection, emails: for an address that an SSO has verified), and they find their apps on "Your apps".

## What to know

The enterprise connection goes through OpenID Connect (Keycloak, Google Workspace, Microsoft Entra), with the Pro and Enterprise plans. Without a list, the organization's members come in. A list gives access to groups, addresses or address domains, and `members: true` adds the members to it.

The app receives `X-While-Identity`, an ES256 JWT signed by while (public key on the app's address, `/__while/jwks.json`), which is the proof. To decide, it checks its signature, issuer, expiry and the `while_projet`, `while_service` and `while_environnement` claims, which it compares to its `WHILE_PROJECT`, `WHILE_SERVICE` and `WHILE_ENVIRONMENT`. `X-While-Email`, `X-While-Name` and `X-While-Groups` are for display only.

A person's agent opens the app as them, for one hour: `open_internal_app` (POST `/v1/projects/:slug/app-access`) gives it a credential to put in the Cookie header (`__Host-while-agent`), never in the address. `read_only` restricts it to reading, and the app knows it (`while_agent` in `X-While-Identity`).

Going from public to internal is immediate. Changing who comes in always waits for an approval, and so does making the app public, by default, unless an organization rule loosens it. Only the health path answers a signed probe from while, and a rollback does not change the access in force.

## Your agent's MCP tools

Your agent handles it with the `plan_deploy`, `get_app_status` and `list_tokens` tools.

## Guides

- [Restrict an internal tool to Google Workspace or Microsoft 365 accounts, from your AI agent](/en/guides/internal-tool-company-sign-in/)
- [Show your app to a client with a link and a password, from your AI agent](/en/guides/share-app-with-password/)
