# Connections

Connect a Google account or an API key once, then call its API from your server without handling tokens.

Hosts: Node, Docker, Cloudflare, Vercel, Netlify, Deno.

![The Connections page of the ViteHub Console lists four Connections with their type, status, and account.](https://vitehub.dev/images/console-connections-light.webp)


### [Connect an account once](https://vitehub.dev/docs/connections/get-started#connect-the-account)

Sign in to the provider once. The app keeps the tokens encrypted in its database.

### [Typed calls, fresh tokens](https://vitehub.dev/docs/connections/server-api#calls)

`useConnection()` gives typed methods such as `gmail.users.labels.list()`. Tokens refresh before they expire.

### [Decide who can read and write](https://vitehub.dev/docs/connections/configure#access-rules)

Rules allow reads and writes per caller. A caller without a rule is denied.

### [Tokens go only to the right API](https://vitehub.dev/docs/connections/configure#provider-origins)

A request to any other address fails and gets no token.

### [API keys work too](https://vitehub.dev/docs/connections/configure#api-key-connections)

Add a key while the app runs, not in code. The same rules apply.

### [A record of each change](https://vitehub.dev/docs/connections/server-api#activity)

Records writes, denied calls, and failures. Never stores tokens or request bodies.

Use Connections when a person or application must connect a provider account with OAuth 2 or an API key, then call that provider through an explicit access policy.

Connections require a Database and encryption key policy. Keep provider scopes and operation allowlists visible. A connected account is not automatically available to an Agent or route.

Keep the connected account, actor, and operation scope in the request policy.
Never expose provider tokens to application responses or Agent prompts.

Prove the connect and callback flow, an authorized operation, and a denied operation. Inspect the stored metadata without exposing tokens.

<!-- vitehub-docs:section-links -->
## In this section

- [Overview](https://vitehub.dev/raw/docs/connections.md) (this page)
- [Get started](https://vitehub.dev/raw/docs/connections/get-started.md)
- [Configure](https://vitehub.dev/raw/docs/connections/configure.md)
- [Server API](https://vitehub.dev/raw/docs/connections/server-api.md)
- [Limits and errors](https://vitehub.dev/raw/docs/connections/limits-and-errors.md)
- [ChatGPT plan usage](https://vitehub.dev/raw/docs/connections/chatgpt.md)

Next: [CONNECTIONS_APPROVAL_REQUIRED](https://vitehub.dev/raw/docs/connections/diagnostics/connections_approval_required.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
