IntegrationsOfficial documentation8 min readIntegrations

Set Up FastGPT Share Link Authentication

Share Link Authentication Overview This guide covers custom identity verification for FastGPT shared chat links, enabling teams to restrict access and tra…

Share Link Authentication Overview

This guide covers custom identity verification for FastGPT shared chat links, enabling teams to restrict access and track usage of publicly shared AI chat interfaces. When configured, every access attempt to a shared link will trigger validation and reporting requests to your custom authentication endpoints.

Step-by-Step Configuration Workflow

1. Configure Verification Root URL

Input the root URL of your authentication service in the FastGPT admin settings. You do not need to specify the full request path, as FastGPT automatically appends standardized endpoint paths. All validation and reporting traffic will be sent to this configured root.

2. Attach authToken Parameter to Shared Links

Add the authToken query parameter to your existing FastGPT shared link. The base shared link format is https://share.fastgpt.io/chat/share?shareId=[shareId]. The authenticated link format is https://share.fastgpt.io/chat/share?shareId=[shareId]&authToken=[userCredential], where authToken is a unique user credential generated by your external system. FastGPT includes the value of this parameter as the token field in all verification request bodies.

3. Implement Init Verification Endpoint

FastGPT sends a POST request to {{host}}/shareAuth/init when a user first loads the shared chat link. This endpoint validates the user’s token before granting access to the chat interface.

Request Example

curl --location --request POST '{{host}}/shareAuth/init' \
--header 'Content-Type: application/json' \
--data-raw '{
    "token": "[authToken]"
}'

Success Response

{
  "success": true,
  "data": {
    "uid": "Unique user identifier"
  }
}

On success, FastGPT loads chat history associated with the returned uid for the shared link.

Failure Response

Return a JSON object with success: false and an error message:

{
  "success": false,
  "message": "Authentication failed"
}

4. Implement Pre-Chat Verification Endpoint

FastGPT sends a POST request to {{host}}/shareAuth/start before the AI generates a response to a user’s question. This endpoint validates the user’s token and scans the incoming question for policy compliance.

Request Example

curl --location --request POST '{{host}}/shareAuth/start' \
--header 'Content-Type: application/json' \
--data-raw '{
    "token": "[authToken]",
    "question": "User question",
}'

The success response matches the init endpoint format. Valid failure responses include a generic authentication error or a content policy violation:

{
  "success": false,
  "message": "Authentication failed"
}
{
  "success": false,
  "message": "Content policy violation"
}

5. Optional Usage Reporting Endpoint

Add a POST endpoint at {{host}}/shareAuth/finish to receive detailed usage data after each completed chat interaction. This endpoint has no required response format. The request body includes the token field and a responseData array with breakdowns of AI resource consumption. Key fields to reference include totalPoints (total AI points consumed) and tokens (total token consumption).

Source: FastGPT official source

Applicability and version scope

Use this page for the documented Integrations scenario. Confirm the FastGPT, dependency, API, and deployment versions in the official source before applying a change.

Safety guardrails

Use [REDACTED_CREDENTIAL] for credentials and private data. Confirm the documented environment and version before review.

Rollback guidance

Restore the prior technical-content authority snapshot. Restore saved configuration and data snapshots, then repeat the smallest verification scenario.