---
title: "Sign-up and sign-in"
description: "Decide who may open an account with SIGNUP_MODE, provision a customer's first owner when sign-up is closed, and configure GitHub, GitLab and Google sign-in."
---

Two decisions belong to the operator rather than to any one organization: who
may open an account on this deployment at all, and which external providers
people may sign in with. Both are environment settings on the API, both are
read at startup, and changing either means restarting it.

Single sign-on against a customer's own identity provider is configured per
organization, by that organization. See
[Set up single sign-on](/how-to/set-up-single-sign-on).

## Who may open an account

| Variable | Default | Purpose |
|---|---|---|
| `SIGNUP_MODE` | `open` | `open`, `invite_only` or `closed`. Read case-insensitively. Any other value stops the API at startup |

| Mode | A new account is created when | The new account lands in |
|---|---|---|
| `open` | Anyone signs up | A new organization of their own, as its owner |
| `invite_only` | The address holds a pending invitation | The organization that invited them |
| `closed` | Never | Nothing is created |

`open` is the default because it is what an unset variable has always meant,
and changing that would silently close sign-up on a deployment relying on it.
It is the right mode for an evaluation or a public sandbox. A deployment
holding real customer data should choose one of the other two.

An unrecognised value is a startup failure rather than a fallback. Falling
back to `open` would turn a typo into an open door, and falling back to
`closed` would turn one into an outage.

### What `invite_only` checks

The mode gates **both** ways an account comes into existence:

- **`POST /api/v1/auth/signup`** must carry an `invitation_token`, the token
  must resolve, and the email in the request must be the address the
  invitation was issued to. A forwarded link does not let someone else take
  the seat.
- **A first sign-in through GitHub, GitLab or Google** creates an account only
  if the address the provider reports has a pending invitation, and only if
  the provider says that address is verified. Anyone can put a colleague's
  address on a profile; an unverified one is refused.

The sign-in page sends the token for you when someone arrives from an invitation
link and chooses to sign up, and they join the organization straight away.

A refused sign-up answers `403` with the reason in `error`. People who already
have an account sign in exactly as before under every mode.

`invite_only` does not need a mail relay. An invitation's link is shown once
to the person who created it, who can send it however they like. See
[Signing in](/getting-started/signing-in).

### The first account of a new customer

Under `invite_only`, an invitation needs an organization to invite into, and
an invitation cannot confer the owner role. Under `closed`, nothing creates an
account at all. In both, a new customer's first owner is created from your side:
**Add customer** in the [staff console](/deployment/staff-console), or, where nobody
can reach the console yet, on the host:

```bash
docker compose -f infra/docker/docker-compose.prod.yml --env-file infra/docker/.env \
  exec api /app/staffctl org create owner@acme.example "Acme Corp"
```

Either way, the owner's generated password is shown once. The owner signs
in, changes the password, and invites everyone else. See
[`staffctl`](/cli-reference/staffctl#org-create).

### Check the running deployment

A variable in a file is not a variable in a process. The production Compose
file passes `SIGNUP_MODE` to the API explicitly, and defaults it to `open` when
your env file does not set it. After a deploy, ask the API itself:

```bash
curl -s -o /dev/null -w '%{http_code}\n' -X POST https://app.example.com/api/v1/auth/signup \
  -H 'Content-Type: application/json' \
  -d '{"name":"Probe","email":"probe@example.com","password":"a-long-probe-password-1A!"}'
```

`403` means sign-up is gated. Anything else means the API is not running the
mode you think it is. On a deployment that is still `open` the request
succeeds and creates the account, so use an address you control and remove the
account afterwards.

## External sign-in providers

Each provider is optional and independent. Configure the ones you want to
offer; the others stay off.

| Variable | Purpose |
|---|---|
| `GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET`, `GITHUB_REDIRECT_URI` | GitHub sign-in |
| `GITLAB_CLIENT_ID`, `GITLAB_CLIENT_SECRET`, `GITLAB_REDIRECT_URI` | GitLab sign-in |
| `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET`, `GOOGLE_REDIRECT_URI` | Google sign-in |

<Steps>
  <Step title="Register an OAuth application with the provider">
    Give it the callback URL on your API's public origin:

    | Provider | Callback URL |
    |---|---|
    | GitHub | `https://<api-origin>/api/v1/auth/github/callback` |
    | GitLab | `https://<api-origin>/api/v1/auth/gitlab/callback` |
    | Google | `https://<api-origin>/api/v1/auth/google/callback` |
  </Step>

  <Step title="Set the three variables for that provider">
    The redirect URI defaults to
    `http://localhost:8080/api/v1/auth/<provider>/callback`, which is correct
    only in development. Set it to exactly the callback URL you registered:

    ```bash
    GITHUB_CLIENT_ID=<client id>
    GITHUB_CLIENT_SECRET=<client secret>
    GITHUB_REDIRECT_URI=https://app.example.com/api/v1/auth/github/callback
    ```
  </Step>

  <Step title="Restart the API and try it">
    Sign-in starts at `/api/v1/auth/github`, `/api/v1/auth/gitlab` or
    `/api/v1/auth/google`. A provider with no client ID configured answers
    `501` (`not_implemented`) with `GitHub OAuth not configured` (or the equivalent for the other
    two) instead of redirecting.
  </Step>
</Steps>

<Note>
The production Compose file passes the provider variables from your
environment file to the `api` service. Before 2026-10-13 it passed none of
them; see [Production Compose](/installation/production-compose#which-variables-reach-the-containers).
</Note>

Session cookies are `SameSite=Lax`, so the API and the dashboard must share a
registrable domain for a provider sign-in to end in a signed-in dashboard. See
[Environment variables](/configuration/environment#frontend-origins).

### Linking to an existing account

A provider sign-in for an address that already has an account links the two
only when **both** sides have verified the address: the provider reports it as
verified, and the existing TRUSTIVAN account's email is verified too. Otherwise
the sign-in is refused and recorded as a failed sign-in on that account, which
is what stops a provider identity from taking over an account by claiming its
address. An account created with `staffctl org create` is marked verified for
this reason: its owner can add a provider sign-in later.

## The GitHub App

Sign-in with GitHub and the GitHub App are separate registrations with
separate variables. The App is what grants access to repositories.

| Variable | Purpose |
|---|---|
| `GITHUB_APP_ID`, `GITHUB_APP_CLIENT_ID`, `GITHUB_APP_CLIENT_SECRET`, `GITHUB_PRIVATE_KEY` | The App's identity and credentials |
| `GITHUB_WEBHOOK_SECRET` | Authenticates the App's webhook deliveries to `/api/v1/github/webhook` |

Once `GITHUB_APP_ID` or `GITHUB_PRIVATE_KEY` is set, a deployed environment
refuses to start without `GITHUB_WEBHOOK_SECRET`. Unsigned deliveries are
rejected whether or not the check fires.

[Linking an installation](/integrations/pull-request-checks#link-the-github-app)
needs `GITHUB_APP_CLIENT_ID` and `GITHUB_APP_CLIENT_SECRET` as well, because GitHub
lists installations only for a token from the App's own sign-in. On the App,
register the callback URL `https://<api-origin>/api/v1/auth/github-app/callback`,
on the same origin as `GITHUB_REDIRECT_URI`.

## Email verification

| Variable | Default | Purpose |
|---|---|---|
| `REQUIRE_EMAIL_VERIFICATION` | `false` | Refuse a password sign-in until the address is verified |

It needs a working mail relay outside development. See
[Send mail through your SMTP relay](/how-to/configure-smtp).

## Related

- [`staffctl`](/cli-reference/staffctl): provisioning an organization and its
  owner.
- [Signing in](/getting-started/signing-in): what the people you let in see.
- [Environment variables](/configuration/environment#identity-providers): the
  full list.
