> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mirage.strukto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> Authenticate requests to the hosted API with a bearer token.

The hosted API is at `https://api.strukto.ai`. Set `MIRAGE_AUTH_TOKEN` to your
access token and send it on every request:

```bash theme={null}
curl https://api.strukto.ai/v1/workspaces \
  -H "Authorization: Bearer $MIRAGE_AUTH_TOKEN"
```

The API returns `401` when the token is missing, incorrect or expired. The
account associated with the token determines which workspaces are visible.

## Sign in with the CLI

[`mirage login`](https://docs.mirage.strukto.ai/home/access/cli#log-in) signs in to the hosted API and stores
the credentials in a CLI context. [`mirage api`](https://docs.mirage.strukto.ai/home/access/cli#call-any-route)
uses that context to authenticate requests.

### OAuth discovery

The CLI reads `/.well-known/oauth-protected-resource` to discover a deployment's
OAuth issuer and client ID before opening browser sign-in. This endpoint does not
issue tokens. Normal API requests only need the bearer token shown above.

## Other deployments

For another deployment, use its API URL and bearer token. See
[Server authentication](https://docs.mirage.strukto.ai/home/access/http.md#configure-authentication) for local
daemon setup, JWT issuers, audiences and account isolation.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.