> For the complete documentation index, see [llms.txt](https://help.impact.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participant-experiences/microsite-experiences/set-up-sso-for-an-impactcom-microsite-via-jwt.md).

# 通过 JWT 为 impact.com 微站设置 SSO

您的倡导者计划微型站点通常要求客户倡导者先使用用户名和密码注册，才能访问分享链接和奖励详情。不过，作为一种高级替代方案，您也可以在服务器端生成 [JSON Web Token (JWT)](https://en.wikipedia.org/wiki/JSON_Web_Token) ，并通过 URL 参数将其传递给微型站点，以此验证用户身份。

使用此方法时，参与者不会拥有微型站点的登录凭据。相反，他们登录现有的客户门户后，门户会将其重定向到微型站点，并使用 JWT 识别他们、显示个性化内容。

#### 开始之前

{% hint style="warning" %}
**重要提示：** 这是一种高级实现方式，它会绕过微型站点的标准托管身份服务，需要开发团队提供支持才能完成设置。
{% endhint %}

只有在满足以下所有条件时，才应使用此方法：

* 您希望通过自动将参与者登录到计划的微型站点，模拟单点登录 (SSO) 体验。
* 您能够在服务器端生成 JWT。
* 您无法或不希望在网站上安装 [通用跟踪代码 (UTT)](https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/platform-features/tracking/javascript-tag-tracking/tracking-with-universal-tracking-tag-utt.md) 。

{% stepper %}
{% step %}

#### 第 1 步：创建不使用托管身份的微型站点

创建微型站点时，您需要关闭托管身份服务，然后将所有页面设置为允许“未验证”用户访问。 *控制面板* 页面将使用 JWT 验证用户身份并加载微型站点。

<details>

<summary>创建微型站点</summary>

首先，调整设置以关闭 *参与者登录* 选项。

1. 在左侧导航菜单中，选择 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2FGgFZ4TpepHNOLrRI2yRk%2Fimage.png?alt=media\&token=5b166f3c-f805-4aaf-b2c4-0f7e11697ec0) **\[Engage]** **→ 内容**.
2. 在 *微型站点* 卡片上，选择 **编辑设置**.
3. 随后，系统会将您重定向到新的 *微型站点设置* 页面。
4. 在 *登录* 部分中， ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2FACIoqj1Ayhx8QzL9aqYB%2Ftoggle-off-solid%20\(1\).svg?alt=media\&token=a85366cd-4b70-41a6-83df-319f89597ede) **\[关闭]** **参与者登录**.
5. 选择 **保存设置**.

</details>

<details>

<summary>配置控制面板页面</summary>

接下来，将微型站点的 *控制面板* 页面设置为对未验证用户可见。然后，将页面上的组件与您的推荐计划关联，以显示正确的信息。

1. 调整网站的 *控制面板* 页面设置。
   * 在左侧导航菜单中，选择 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2FGgFZ4TpepHNOLrRI2yRk%2Fimage.png?alt=media\&token=5b166f3c-f805-4aaf-b2c4-0f7e11697ec0) **\[Engage]** **→ 内容** → **设置内容** 或 **编辑内容**.
   * 在 *微型站点* 选项卡中，选择 **仪表板** 中的 *登录后布局* 部分。
   * 选择 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2FNVJihd9nYKCiCEg5tI6i%2F2a92939e8e78dd7e0c0416b1a250d5ef1d7ab0dec966fb5ed320ca62acfc06c5.svg?alt=media\&token=7cab8ce5-a26b-4057-a822-0746130d9117) **\[菜单] → 设置**.
   * 在 *允许的用户* 下拉列表中，选择 **未验证**.
2. 将程序 ID 添加到 *仪表板*.
   * 用户统计信息 — 必须将 ID 添加到要显示的每项用户统计信息中。
   * 分享链接
   * 推荐码
   * 社交媒体按钮 — 必须将 ID 添加到要包含的每个社交媒体分享按钮中。
3. 在右上角，选择 **保存**.

   <div data-with-frame="true"><figure><img src="https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2FILGfObvnj8KJZ7tCnv1N%2FScreenshot%202026-05-18%20at%2008.35.52.png?alt=media&amp;token=e25b48a9-0ec3-4410-9dc0-feb609d46d34" alt="" width="563"><figcaption></figcaption></figure></div>

如需了解如何使用编辑器查找和调整页面及组件设置，请参阅 [微型站点编辑器说明](https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participant-experiences/microsite-experiences/microsite-editor-explained.md) 和 [自定义微型站点布局和页面](https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participant-experiences/microsite-experiences/customize-microsite-layouts-and-pages.md).

</details>

<details>

<summary>删除不需要的页面</summary>

删除微型站点不会使用的布局和页面。

1. 将光标悬停在页面或布局上。
2. 选择 ![](https://1186853034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2FMLtRUwWz0pujlfmYWOgg%2FMoreVN.svg?alt=media\&token=03a3c355-a347-4207-baf7-c44fadf6d080) **\[更多]** **→ 删除**.
3. 删除 *登录后布局*.
4. 删除以下页面：
   * 编辑个人资料
   * 电子邮件验证
   * 忘记密码
   * 登录
   * 退出登录
   * 注册
   * 重置密码
   * 验证电子邮件

</details>
{% endstep %}

{% step %}

#### 步骤 2：生成 JWT

JWT 结构遵循 Advocate 用户身份验证的标准要求。如果你之前集成过 Advocate，可能已经在为 UTT 生成类似的令牌。

必须在服务器或任何受信任的后端系统上安全地生成 JWT，切勿在浏览器中生成。

了解如何 [生成 JWT 以及载荷要求](https://integrations.impact.com/integration-guides/for-brands/advocate/advocate-tracking-integrations/json-web-tokens-jwts).
{% endstep %}

{% step %}

#### 步骤 3：将 JWT 附加到微型站点 URL

用户登录你的平台后，将其重定向到微型站点，并在 URL 查询字符串中附上 JWT。

{% hint style="info" %}
**示例：** `https://your-microsite.squatch.app/?jwt=<YOUR_GENERATED_JWT>`
{% endhint %}

你可以在新的浏览器标签页中打开微型网站，也可以使用 iframe 将其嵌入应用中。如果决定嵌入微型网站，请确保妥善处理 [跨源资源共享 (CORS)](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) 以及浏览器限制。
{% endstep %}
{% endstepper %}

#### 备注

* 如果使用此身份验证方式，用户将无法获得微型网站的登录凭据。
* 必须严格控制基于 JWT 的访问。请勿在客户端 JavaScript 中暴露或操纵 JWT。
* 这是一种非标准做法——在推出程序之前，请在预发布环境中进行充分测试。
* 如果需要 [支持](mailto:saasquatch-support@impact.com)请在支持请求中附上微型网站 URL、实现详情以及 JWT 载荷示例。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.impact.com/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participant-experiences/microsite-experiences/set-up-sso-for-an-impactcom-microsite-via-jwt.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
