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 for more information.Example:
option.object({
  apiKey: option.string.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.
extraAuthParams
object
Additional parameters to include in the authorization request.
Example:
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",
  },
});