What’s This About?

When your AI needs to access secure parts of your system (like user data or private APIs), it needs the right permissions. This guide shows you how to set that up.

Two Ways to Add Authentication

1. From Your App (Dynamic Auth)

If you’re using our widget in your app, you can pass authentication tokens directly:

initAiCoPilot({
    // Other settings...
    headers: {
        // Add any auth headers you need
        "Authorization": "Bearer your-token-here",
        "API-Key": "your-api-key",
        // Add as many headers as you need
    }
});

This is great when:

  • Your users need to be logged in
  • Each user has their own permissions
  • You’re using JWT tokens or API keys

2. From Our Dashboard (Static Auth)

If you need to set up authentication that’s the same for everyone:

1

Go to Settings

Open your copilot dashboard and find “Copilot Settings”

2

Find Headers Section

Scroll down to “Global variables/headers”

3

Add Your Headers

Add any authentication headers you need:

  • API keys
  • Access tokens
  • Custom headers

This is perfect when:

  • You’re using the AI on a public website
  • You don’t want to expose tokens in your frontend code
  • You need the same authentication for all users
  • You’re testing things out

Security & Storage

Important Security Information:

  • Headers passed through the widget (initAiCoPilot) are never stored in our system
  • Only headers configured in the dashboard are stored, and these are encrypted in our database
  • We follow industry-standard encryption practices to protect your sensitive data

Widget Headers

  • Not stored anywhere
  • Used only during runtime
  • Perfect for user-specific tokens

Dashboard Headers

  • Encrypted in our database
  • Safely stored and managed
  • Ideal for system-wide tokens

Quick Tips

Security First

Never put sensitive tokens in your frontend code if you can avoid it

Test It Out

Always test your authentication with a few API calls before going live

Need help? Join our Slack community for support!