# Credentials in Vault

> Third-party tokens and API keys in Supabase Vault as bs:cred:<provider>:<name>, behind security definer credential_get, credential_set and credential_delete functions only the service role may call. vaultCredentials() in better-supabase/credentials resolves credential references through them.

- Category: Developer platform
- Module: `credentials`
- Modes: `managed`, `custom`
- Docs: https://bettersupabase.com/docs/blocks/credentials
- Page: https://bettersupabase.com/blocks/credentials

## Install

```bash
npx better-supabase add credentials
```

## Configure

Add the block to `better-supabase.config.ts`:

```ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  blocks: {
    // Modes: "managed", "custom". The default is "managed".
    credentials: { mode: "managed" },
  },
});
```

## Client

The block is SQL only: call its functions from your policies, RPCs and the other modules.

## Events

- `credential.deleted`
- `credential.updated`

## Recipes

- [Connector credentials](https://bettersupabase.com/recipes/connector-setup.md): A sheet that stores a connector credential encrypted and revokes it, without reading the secret back.
