Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

2.5 KB
Raw Blame
import { stack } from '../../packages/shared';
import { AUTHENTICATION_SERVICE_DOMAIN } from './constants';

/**
 * Creates an array of allowed origins for the fusionauth application depending on stack
 */
export const ALLOWED_ORIGINS = () => {
  const allowedOrigins = [
    AUTHENTICATION_SERVICE_DOMAIN,
    'https://platform.openai.com',
    'https://platform.claude.com',
    'https://console.anthropic.com',
    // Google's sign-in pages send the browser back to FusionAuth, which reads
    // their origin and otherwise ends Google sign-in with `invalid_origin`.
    'https://accounts.google.com',
  ];

  switch (stack) {
    case 'local':
      return [
        ...allowedOrigins,
        'http://localhost:3000',
        'http://localhost:3001',
        'http://localhost:3002',
        'http://localhost:3003',
        'http://localhost:3004',
        'http://localhost:3005',
        'http://localhost:3006',
        'http://localhost:3007',
        'http://localhost:3008',
        'http://localhost:3009',
        'http://localhost:5173',
        'https://github.com',
        'https://claude.ai',
        'https://chatgpt.com',
        'https://chat.openai.com',
        'https://cursor.com',
        'https://www.cursor.com',
      ];
    case 'dev':
      return [
        ...allowedOrigins,
        'https://dev-gateway.macro.com',
        'http://localhost:3000',
        'http://localhost:3001',
        'http://localhost:3002',
        'http://localhost:3003',
        'http://localhost:3004',
        'http://localhost:3005',
        'http://localhost:3006',
        'http://localhost:3007',
        'http://localhost:3008',
        'http://localhost:3009',
        'https://dev.macro.com',
        'http://localhost:8084',
        'http://localhost:5173',
        'https://dashboarddev.macro.com',
        'https://github.com',
        'https://claude.ai',
        'https://chatgpt.com',
        'https://chat.openai.com',
        'https://cursor.com',
        'https://www.cursor.com',
      ];
    case 'prod':
      return [
        ...allowedOrigins,
        'https://gateway.macro.com',
        'https://macro.com',
        'https://dashboard.macro.com',
        'https://staging.macro.com',
        'https://www.macro.com',
        'https://pdf.macro.com',
        'https://github.com',
        'https://claude.ai',
        'https://chatgpt.com',
        'https://chat.openai.com',
        'https://cursor.com',
        'https://www.cursor.com',
      ];
  }

  throw new Error('invalid stack');
};