Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

948 B
Raw Blame
import { PieceAuth, AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';
import { tryCatch } from '@activepieces/pieces-framework';

import { validateGlideAuth } from './common/client';

export const glideAuth = PieceAuth.SecretText({
  displayName: 'Secret Token',
  description: `
To get your token:
1. Open Glide and go to the **Data** editor.
2. Open a Big Table and click **Show API**.
3. Copy the **secret token** shown in the API details.
4. Paste it below.

This piece uses Glide's Big Tables API, so the available actions work with Big Tables only.`,
  required: true,
  validate: async ({ auth }) => {
    const { error } = await tryCatch(() => validateGlideAuth(auth));

    if (error) {
      return {
        valid: false,
        error: 'Invalid Glide secret token.',
      };
    }

    return {
      valid: true,
    };
  },
});

export type GlideAuthType = AppConnectionValueForAuthProperty<typeof glideAuth>