# auth.md: Glance API authentication

Glance's API and CLI take an API key. The remote MCP server takes that key or an OAuth sign in.

## Connecting an AI app

Add `https://clientglance.com/mcp` (Streamable HTTP) as a connector in Claude or ChatGPT, or run `claude mcp add --transport http clientglance https://clientglance.com/mcp` in Claude Code. The app opens Glance, the person signs in with an email code, picks the workspace and presses Allow.

- OAuth 2.1, authorization code with PKCE (S256 only). Public clients: no client secret.
- Clients register at `https://clientglance.com/oauth/register` (RFC 7591) or use a Client ID Metadata Document as the client_id.
- Metadata: `https://clientglance.com/.well-known/oauth-authorization-server` and `https://clientglance.com/.well-known/oauth-protected-resource/mcp`.
- An access token lasts an hour. The refresh token lasts 60 days and works once: each refresh hands back a new pair.
- A connection acts for one workspace. The person disconnects it under Settings, Connected apps.

## Getting a key

An owner or admin creates one under Settings, Developers. It starts with `cg_live_` and shows once. An agent can't mint a key for somebody else's workspace; ask the person for theirs.

## Using it

- HTTP API: `Authorization: Bearer cg_live_...` on every request to `https://clientglance.com/api/v1/`.
- Remote MCP: `https://clientglance.com/mcp` with the same header.

A missing or wrong key answers 401. Revoking the key under Settings stops it at once.

## Reference

- OpenAPI: https://clientglance.com/api/v1/openapi.json
