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

# Auth

## Encrypted credentials

**type** `'encryptedCredentials'` *required*

The authentication type.

**name** `string` *required*

The name of the credentials. I.e. `Twitter account`, `OpenAI account`, `Stripe
    keys`, etc.

**schema** `z.ZodObject\<any\>` *required*

The schema of the data that needs to be stored. See [Options](https://docs.typebot.com/contribute/the-forge/options.md) for
more information.

Example:

```ts theme={null}
option.object({
  apiKey: option.string.meta({ layout: {
    isRequired: true,
    label: "API key",
    withVariableButton: false,
  } }),
});
```

## OAuth

**type** `'oauth'` *required*

The authentication type for OAuth 2.0 flow.

**name** `string` *required*

The name of the credentials. I.e. `Gmail account`, `Google Drive`, `GitHub
    account`, etc.

**authUrl** `string` *required*

The authorization URL for the OAuth provider where users will be redirected to
authenticate.

**tokenUrl** `string` *required*

The token endpoint URL where the authorization code will be exchanged for
access tokens.

**scopes** `string[]` *required*

An array of OAuth scopes that define the permissions your application is
requesting.

**defaultClientEnvKeys** `object`

An object defining the default environment variable names for the OAuth client
credentials.

**Properties**

**id** `string` *required*

The environment variable name for the OAuth client ID.

**secret** `string` *required*

The environment variable name for the OAuth client secret.

**extraAuthParams** `object`

Additional parameters to include in the authorization request.

Example:

```ts theme={null}
const gmailScopes = [
  "https://www.googleapis.com/auth/gmail.send",
  "https://www.googleapis.com/auth/gmail.labels",
  "https://www.googleapis.com/auth/userinfo.profile",
  "https://www.googleapis.com/auth/userinfo.email",
] as const;

export const auth = createAuth({
  type: "oauth",
  name: "Gmail account",
  authUrl: "https://accounts.google.com/o/oauth2/v2/auth",
  tokenUrl: "https://oauth2.googleapis.com/token",
  scopes: gmailScopes,
  defaultClientEnvKeys: {
    id: "GMAIL_CLIENT_ID",
    secret: "GMAIL_CLIENT_SECRET",
  },
  extraAuthParams: {
    access_type: "offline",
    prompt: "consent",
  },
});
```


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