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

# 接入客户的社交账户

> 使用 MCP Server 通过 JWT 社交账户关联 URL，将客户的社交账户接入到子配置文件（sub-profile）中。

使用 Business 或 Enterprise 套餐的集成商可以将客户的社交账户接入到 **子配置文件（sub-profile）** 下。借助 [MCP Server](/additional/mcp-action-server)，代理会创建一个子配置文件、将其设为目标，并生成一个供客户打开以连接账户的单点登录关联 URL。

## 流程

<Steps>
  <Step title="创建子配置文件">
    调用 `create_profile`（账户级 — 无需 `profileKey`）。它会返回新子配置文件的 **profile key**。
  </Step>

  <Step title="将子配置文件设为目标">
    在后续调用中使用返回的 profile key —— 可以通过连接上的 `Profile-Key` 请求头，或者作为单次调用的 `profileKey` 参数传入。有关优先级请参见 [Connect & Setup](/additional/mcp-action-connect#precedence-argument-wins-over-header)。
  </Step>

  <Step title="生成社交账户关联 URL">
    调用 `generate_jwt_social_linking_url` 生成一个单点登录关联 URL。JWT 签名密钥和接入域名均在 **服务器端** 推导 —— 调用方 **无需** 提供任何 `X-Ayrshare-*` 请求头，也无需提供私钥或域名。
  </Step>

  <Step title="客户完成账户关联">
    客户打开该 URL 并对其社交账户进行授权（OAuth）。已连接的账户会关联到该子配置文件。
  </Step>
</Steps>

## 前置要求

<Warning>
  `generate_jwt_social_linking_url` **必须** 提供 `profileKey`。如果无法解析出 profileKey，接口将返回 **400**，错误信息为 **"Profile Key is required…"**。

  你的账户还必须 **已开通社交账户关联域名（social-linking domain）**。此功能在 **Business** 和 **Enterprise** 套餐中提供。
</Warning>

### 错误状态

| 条件    | 响应                                                                                                             |
| ----- | -------------------------------------------------------------------------------------------------------------- |
| 未开通域名 | **400** — "No social-linking domain is provisioned for this account (available on Business/Enterprise plans)." |
| 无签名密钥 | **400** — "No signing key found for this account's social-linking domain."                                     |

## 后续步骤

<CardGroup cols={2}>
  <Card title="Connect & Setup" icon="plug" href="/additional/mcp-action-connect" horizontal>
    身份认证与配置文件定位。
  </Card>

  <Card title="工具目录" icon="list" href="/additional/mcp-action-tools" horizontal>
    按领域分组的 27 个工具，包含作用范围与用途。
  </Card>
</CardGroup>
