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

# External Auth Setup

> Configure how external user tokens are validated so signed-in users can use your public agents

External Auth lets you connect your own identity provider (IdP) to AMAS so that **signed-in users** can use your public chatbots. When a user chats, their token (JWT) is validated against the sign-in system you configure here. Each configuration is scoped to your company and can be reused across multiple agents.

<Frame>
  <img src="https://mintcdn.com/arttacsolutions/xwsmX3Kdmvw1ENwl/images/external_auth_overview.png?fit=max&auto=format&n=xwsmX3Kdmvw1ENwl&q=85&s=532c90f3eb1f0c77ef57c50205e75324" alt="External Auth Config overview" width="1918" height="951" data-path="images/external_auth_overview.png" />
</Frame>

## When to Use External Auth

* You enabled **Public Access** on an agent and chose **Signed-in users only**.
* You want only verified users from your identity provider (for example Microsoft Entra ID or any OpenID Connect provider) to chat.
* You want each user's conversations saved to their personal Library.

<Info>
  You select a configured sign-in system per agent in the agent's **General** settings. See [Agent Management](/documentation/studio/my-agents#agent-settings).
</Info>

## How It Works

Configurations are **immutable and versioned**:

* Saving changes never edits an existing version — it creates a **new version** and re-points the active one.
* You can **roll back** or **fast-forward** by activating any previous version.
* Secrets (such as a static public key) are **write-only**: they must be re-entered when creating a new version.

```mermaid theme={null}
flowchart LR
  A[User signs in via your IdP] --> B[User token JWT]
  B --> C[AMAS validates token against active config]
  C -->|valid| D[User chats and conversations saved]
  C -->|invalid| E[Access denied]
```

## Creating a Sign-in System

<Steps>
  <Step title="Open External Auth Setup">
    Go to **Settings** and open **External Auth Config** (also reachable via **Configure External Auth Setup** from an agent's General tab).
  </Step>

  <Step title="Create a new setup">
    Click **New Setup** and provide:

    * **Name**: A recognizable label (e.g. "Acme SSO (Entra ID)"). This name appears in the agent's public chatbot settings.
    * **Description** (optional): Who signs in with this provider and where it's used.

    <Frame>
      <img src="https://mintcdn.com/arttacsolutions/xwsmX3Kdmvw1ENwl/images/external_auth_new_setup.png?fit=max&auto=format&n=xwsmX3Kdmvw1ENwl&q=85&s=eabec3690db9e68f4501bc6bc197b786" alt="New setup modal" width="619" height="414" data-path="images/external_auth_new_setup.png" />
    </Frame>
  </Step>

  <Step title="Add a configuration version">
    With the setup selected, click **Add Configuration** and choose a **Validation Type** (see below).

    <Frame>
      <img src="https://mintcdn.com/arttacsolutions/xwsmX3Kdmvw1ENwl/images/external_auth_config_editor.png?fit=max&auto=format&n=xwsmX3Kdmvw1ENwl&q=85&s=1fa1a51871d638a5bba0fa5bd4dbcd84" alt="Configuration version editor" width="671" height="627" data-path="images/external_auth_config_editor.png" />
    </Frame>
  </Step>

  <Step title="Save">
    Click **Save New Version**. The new version becomes the **active** configuration immediately.
    <Check>The setup shows an active version label and the validation type you selected.</Check>
  </Step>
</Steps>

## Validation Types

Choose how tokens are verified. Only the fields relevant to the selected type are shown.

<Tabs>
  <Tab title="OIDC Discovery">
    Uses the provider's well-known discovery document to locate signing keys automatically.

    <ParamField path="Discovery URL" type="url" required>
      The OpenID configuration endpoint, e.g. `https://issuer/.well-known/openid-configuration`.
    </ParamField>
  </Tab>

  <Tab title="JWKS URL">
    Fetches signing keys directly from a JWKS endpoint.

    <ParamField path="JWKS URL" type="url" required>
      The JSON Web Key Set endpoint, e.g. `https://issuer/.well-known/jwks.json`.
    </ParamField>
  </Tab>

  <Tab title="Public Key URL">
    Fetches a public key from a custom endpoint.

    <ParamField path="Public Key URL" type="url" required>
      The endpoint serving the public key, e.g. `https://issuer/keys`.
    </ParamField>

    <ParamField path="Public Key JSON Path" type="string">
      Optional dotted path used to extract the public key from the JSON response.

      **Supported syntax:**

      * **Object properties**: `field.subfield`
      * **Array indices**: `field[0]`, `field[1]`
      * **Root-level arrays**: `[0]`, `[1]`

      **Examples:**

      <CodeGroup>
        ```json Object Property theme={null}
        // JSON Response
        {
          "keys": {
            "public": "-----BEGIN PUBLIC KEY-----..."
          }
        }

        // Path
        keys.public
        ```

        ```json Array Index theme={null}
        // JSON Response
        {
          "keys": [
            {
              "public": "-----BEGIN PUBLIC KEY-----..."
            }
          ]
        }

        // Path
        keys[0].public
        ```

        ```json Root Array theme={null}
        // JSON Response
        [
          {
            "public": "-----BEGIN PUBLIC KEY-----..."
          }
        ]

        // Path
        [0].public
        ```
      </CodeGroup>
    </ParamField>
  </Tab>

  <Tab title="Static Public Key">
    Validates tokens against a fixed PEM key you paste in.

    <ParamField path="Static Public Key (PEM)" type="string" required>
      The PEM-encoded public key, starting with `-----BEGIN PUBLIC KEY-----`.
    </ParamField>
  </Tab>
</Tabs>

### Common Fields

These optional fields apply to every validation type:

<ParamField path="Issuer" type="string">
  Expected `iss` claim. When set, tokens with a different issuer are rejected.
</ParamField>

<ParamField path="Audience" type="string">
  Expected `aud` claim. When set, tokens with a different audience are rejected.
</ParamField>

### Advanced Settings

<ParamField path="User Identifier Claim" type="string" default="sub">
  The claim used to identify the user (for example `sub` or `email`).
</ParamField>

<ParamField path="Allowed Algorithms" type="array">
  Comma-separated list of accepted signing algorithms (for example `RS256`). Sensible defaults are applied per validation type.
</ParamField>

<ParamField path="Enforced Required Claims" type="array">
  Comma-separated claims (other than the user identifier) that MUST be present in the token for validation to succeed (for example `email, roles`).
</ParamField>

## Managing Versions

<Frame>
  <img src="https://mintcdn.com/arttacsolutions/xwsmX3Kdmvw1ENwl/images/external_auth_versions.png?fit=max&auto=format&n=xwsmX3Kdmvw1ENwl&q=85&s=0421640c320b398ea2b9034d1834661c" alt="Version history" width="1100" height="462" data-path="images/external_auth_versions.png" />
</Frame>

* **Version History** lists every saved configuration with its validation type, creation time, and author.
* The **active** version is highlighted and is the one used to validate tokens.
* Open a version to **view its details** and **Activate** it to roll back or fast-forward.

<Note>
  Activating an older version takes effect immediately for all agents using this setup.
</Note>

## Testing a Configuration

Before relying on a configuration, validate a real token against it.

<Frame>
  <img src="https://mintcdn.com/arttacsolutions/xwsmX3Kdmvw1ENwl/images/external_auth_test.png?fit=max&auto=format&n=xwsmX3Kdmvw1ENwl&q=85&s=276152783b9892379c592a6a3845536c" alt="Test configuration" width="1054" height="492" data-path="images/external_auth_test.png" />
</Frame>

<Steps>
  <Step title="Select a version">
    Choose which version to test against (the active one is marked).
  </Step>

  <Step title="Paste a JWT">
    Paste a token issued by your identity provider.
  </Step>

  <Step title="Run the test">
    Click **Test Token**. The result shows whether the token is valid, any validation errors, the resolved **user identifier**, and the decoded claims.
    <Check>A valid token returns "Token is valid" with the expected user identifier.</Check>
  </Step>
</Steps>

## Connecting to an Agent

<Steps>
  <Step title="Open the agent's General settings">
    In **Agent Management**, open **Settings** and go to the **General** tab.
  </Step>

  <Step title="Enable public access">
    Turn on **Public Access** and provide an **Allowed Origin URL**.
  </Step>

  <Step title="Require sign-in">
    Under **Who can use the chatbot?**, choose **Signed-in users only**.
  </Step>

  <Step title="Select the sign-in system">
    Pick the External Auth configuration you created from the **Sign-in system** dropdown, then save.
  </Step>
</Steps>

<Info>
  See [Agent Management → General](/documentation/studio/my-agents#agent-settings) for the agent-side configuration.
</Info>

## Deleting a Setup

Deleting a setup removes it and all of its config versions. Agents using it will no longer be able to authenticate external tokens.

<Warning>
  Deletion cannot be undone. Make sure no public agent depends on the setup before deleting it.
</Warning>

## What's Next?

<CardGroup cols={2}>
  <Card title="Agent Management" icon="robot" href="/documentation/studio/my-agents">
    Configure public access and sign-in per agent
  </Card>

  <Card title="Settings" icon="key" href="/documentation/studio/settings">
    Manage API keys and OAuth integrations
  </Card>

  <Card title="Chatbot Integration" icon="code" href="/documentation/integration/chatbot-integration">
    Embed an agent in your website
  </Card>

  <Card title="REST API Tutorial" icon="plug" href="/documentation/integration/rest-api-tutorial">
    Connect your agents to applications
  </Card>
</CardGroup>


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