# Connect your identity provider

Source: https://dropshelf.ai/docs/self-host/configure/identity-provider

Connect dropshelf to Auth0, Microsoft Entra ID or any OpenID Connect provider, and decide who is an admin.

dropshelf has no passwords of its own: people sign in through your identity provider. This page is
for the operator who registers dropshelf at the provider and writes the `auth` block of its
configuration.

dropshelf signs people in with OpenID Connect (OIDC) and the authorization code flow. You register
one client at your provider, with the redirect URI `<publicBaseURL>/auth/callback`. dropshelf knows
each person by their email address, so the ID token must carry an address the provider has
verified. A sign-in without a verified address is always refused.

Each block on this page goes in the server's configuration file. On a Helm install, put it under
`config:` in your values file.

## Prerequisites [#prerequisites]

- You can create applications at your identity provider.
- You know the dashboard address, such as `https://drop.example.com`. [Set up domains and
  TLS](/docs/self-host/configure/domains-and-tls) covers it.
- The environment or the Kubernetes Secret holds `DROPSHELF_AUTH_SESSION_SECRETS`, one or more keys of
  at least 32 bytes that encrypt sign-in cookies. The install guides create it.

## Auth0 [#auth0]

To connect an Auth0 tenant:

1. In the Auth0 dashboard, create an application of the type **Regular Web Applications**. Note its
   **Domain**, **Client ID** and **Client Secret**.
2. In **Allowed Callback URLs**, enter `https://drop.example.com/auth/callback`.
3. In **Allowed Logout URLs**, enter `https://drop.example.com/`. Signing out of dropshelf also signs
   the person out of Auth0 and returns them here, and Auth0 refuses a return address it does not list.
4. On the application's **Connections** tab, turn on only the connections your colleagues sign in
   with.
5. Put the client secret in the environment or the Secret as `DROPSHELF_AUTH_OIDC_CLIENT_SECRET`.
6. Add the `auth` block to the configuration, with the application's domain in the issuer:

   ```yaml
   auth:
     provider: oidc
     oidc:
       issuer: https://<auth0-domain>/
       clientId: <client-id>
     admins:
       emails: [admin@example.com]
   ```

7. Apply the change with `helm upgrade`, or restart the server on a single host.

Auth0's database and social connections put the `email_verified` claim in the ID token. Where a
connection's token arrives without it, every sign-in through that connection is refused. To fix it,
add a post-login Action that copies the provider's own answer into the token:

```javascript
exports.onExecutePostLogin = async (event, api) => {
  if (typeof event.user.email_verified === 'boolean') {
    api.idToken.setCustomClaim('email_verified', event.user.email_verified)
  }
}
```

The Action copies the answer and never sets it to `true` on its own. A claim set to `true` for
addresses nobody verified would let those sign-ins in and match them to existing accounts. Whether
an Action may set this claim is Auth0's rule, so check their documentation if it does not arrive.

## Microsoft Entra ID [#microsoft-entra-id]

Entra ID does not put the `email_verified` claim in its ID tokens by default. Without a setting for
that, dropshelf refuses every sign-in.

To connect an Entra ID tenant:

1. In the Microsoft Entra admin center, open **App registrations** and select **New registration**.
2. Under **Redirect URI**, choose **Web** and enter `https://drop.example.com/auth/callback`.
3. In **Certificates & secrets**, create a client secret. Put its value in the environment or the
   Secret as `DROPSHELF_AUTH_OIDC_CLIENT_SECRET`.
4. Add the `auth` block, with your tenant ID in the issuer and the application's client ID:

   ```yaml
   auth:
     provider: oidc
     oidc:
       issuer: https://login.microsoftonline.com/<tenant-id>/v2.0
       clientId: <client-id>
       assumeEmailVerified: true
       allowedEmailDomains: [example.com]
     admins:
       emails: [admin@example.com]
   ```

5. Apply the change with `helm upgrade`, or restart the server on a single host.

`assumeEmailVerified: true` counts an ID token with no `email_verified` claim as verified. A token
whose claim says `false` is still refused. Set it only when your organisation controls every address
the directory admits, guest and federated users included. The address decides who is an admin, who
a drop is shared with and which account a sign-in joins.

To leave `assumeEmailVerified` off, emit the `email_verified` claim from Entra ID instead, through a
claims mapping policy.

## Any other OIDC provider [#any-other-oidc-provider]

Okta, Keycloak, Dex and other OIDC providers need the same values: an issuer, a client ID and a
client secret.

To connect another provider:

1. Register a web application that uses the authorization code flow and has a client secret.
2. Set its redirect URI to `https://drop.example.com/auth/callback`, and its post-logout redirect URI
   to `https://drop.example.com/`.
3. Put the client secret in the environment or the Secret as `DROPSHELF_AUTH_OIDC_CLIENT_SECRET`.
4. Add the `auth` block:

   ```yaml
   auth:
     provider: oidc
     oidc:
       issuer: <issuer-url>
       clientId: <client-id>
       scopes: [openid, profile, email]
       allowedEmailDomains: [example.com]
   ```

5. Apply the change with `helm upgrade`, or restart the server on a single host.

The settings in that block:

- `issuer` is the URL whose `/.well-known/openid-configuration` document describes the provider. The
  server reads it at startup and stops if it cannot, so a wrong issuer shows at once.
- `scopes` defaults to `openid`, `profile` and `email`. Keep `email`, because dropshelf knows people by
  their address.
- `allowedEmailDomains` lets in only verified addresses in the listed domains. An empty list allows
  any address. It does not replace the provider's own rules about who may use the application.

The provider must put `email_verified: true` in the ID token. If it sends no such claim, use
`assumeEmailVerified` under the same conditions as for Entra ID. Leave `requireVerifiedEmail` at
`true`: the server refuses to start with `false`.

## Admins [#admins]

Admins open the admin panel and can act on every drop. dropshelf decides who is an admin from its
configuration, again at every sign-in, and no screen in the dashboard changes it.

Either of two settings makes someone an admin:

```yaml
auth:
  admins:
    emails: [admin@example.com, ravi.patel@example.com]
    claim:
      name: https://drop.example.com/roles
      values: [dropshelf-admin]
```

- `emails` lists addresses, matched without regard to case.
- `claim` names an ID token claim, exactly as your provider emits it, and the values that make its
  bearer an admin. The claim may be a string or a list of strings, and one matching value is enough.

Taking someone off the list, or out of the role, takes effect at their next sign-in. To end their
access at once, disable them, as [Administer dropshelf](/docs/self-host/operate/administration)
describes.

In Auth0, a post-login Action puts the user's roles in the claim:

```javascript
exports.onExecutePostLogin = async (event, api) => {
  api.idToken.setCustomClaim('https://drop.example.com/roles', event.authorization?.roles ?? [])
}
```

A claim name that is a URI on a domain you own cannot collide with a claim something else adds to
the token.

## Sign-in for agents [#sign-in-for-agents]

When `auth.provider` is `oidc`, dropshelf also runs its own OAuth server. The `dropshelf` CLI and
agents such as Claude Code and Codex sign in through it with a browser. It is on by default and needs
nothing at your identity provider.

Act on it in two cases:

- **The instance has no outbound internet access.** Each replica fetches the allowed agents' client
  metadata from `claude.ai` and `chatgpt.com`, through `HTTPS_PROXY` when it is set. Without a way
  out, pin each client in `auth.oauth.clients` with its `name` and `redirectURIs`, and nothing is
  fetched.
- **You want personal access tokens only.** Set `auth.oauth.enabled: false`.

A list in `auth.oauth.clients` replaces the default list, and the `dropshelf` CLI is always allowed.
The [configuration reference](/docs/reference/configuration#auth) has every `auth.oauth` key.

## Run without sign-in [#run-without-sign-in]

`auth.provider: none` turns sign-in off.

<Callout type="warn">
With `auth.provider: none`, every request acts as one local admin, and every drop is open to anyone
who can reach the server. Use it only on a network you trust, such as your own laptop.
</Callout>

## Confirm it worked [#confirm-it-worked]

Open `https://drop.example.com` and sign in. The dashboard opens with your drops, and an admin sees
an **Admin** link in the header. If the server does not start, its log names the setting at fault, and
[Troubleshoot dropshelf](/docs/self-host/operate/troubleshooting) has the common causes.

## Next steps [#next-steps]

- [Choose object storage](/docs/self-host/configure/storage)
- [Set up domains and TLS](/docs/self-host/configure/domains-and-tls)
- [Administer dropshelf](/docs/self-host/operate/administration)
- [Rotate secrets](/docs/self-host/operate/rotate-secrets)
- [Configuration reference: auth](/docs/reference/configuration#auth)
