> 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

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

使用这种方法，参与者不会拥有该微站点的登录凭证。相反，他们通过登录您现有的客户门户来获得访问权限，然后系统会使用 JWT 将他们重定向到微站点，以识别他们并显示其个性化内容。

#### 开始之前

{% hint style="warning" %}
**重要：** 这是一个高级实现，它绕过了微站点的标准 Managed Identity Service，并且需要您的开发团队提供支持来进行设置。
{% endhint %}

只有在以下所有情况都适用时，您才应使用此方法：

* 您希望通过自动将参与者登录到您项目的微站点来模拟单点登录（SSO）体验。
* 您可以在服务器端生成 JWT。
* 您不能或不想安装 [Universal Tracking Tag (UTT)](/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：创建一个不使用托管身份的微站点

创建微站点时，您需要关闭 Managed Identity Service，然后将所有页面设置为“未验证”用户可访问。该 *仪表板* 页面将使用 JWT 对用户进行身份验证并加载微站点。

<details>

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

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

1. 从左侧导航菜单中，选择 ![](/files/4ce7c16cfcd5293cf28d16fe68b852009fc2468d) **\[Engage]** **→ 内容**.
2. 在 *Microsite* 卡片中，选择 **编辑设置**.
3. 然后您将被重定向到新的 *微站点设置* 页面完成。
4. 在 *登录* 部分， ![](/files/c2dcdffe00f000bd34f794287e3006cfa55e8ce8) **\[关闭切换]** **参与者登录**.
5. 选择 **保存设置**.

</details>

<details>

<summary>配置仪表板页面</summary>

接下来，将微站点的 *仪表板* 页面配置为对未验证用户可见。然后，将页面上的组件与您的推荐计划连接起来，以便显示正确的信息。

1. 调整您站点的 *仪表板* 页面设置。
   * 从左侧导航菜单中，选择 ![](/files/4ce7c16cfcd5293cf28d16fe68b852009fc2468d) **\[Engage]** **→ 内容** → **设置内容** 或 **编辑内容**.
   * 从 *Microsite* 选项卡，选择 **仪表板** 中输入 *已登录布局* 部分。
   * 选择 ![](/files/77cad707ec8c8e3ea9d0056e8451a6deaf59419d) **\[菜单] → 设置**.
   * 从 *允许的用户* 下拉列表中，选择 **未验证**.
2. 将您的项目 ID 添加到 *仪表板*.
   * 用户统计 — 您必须将该 ID 添加到您选择显示的每一个单独用户统计项中。
   * 分享链接
   * 推荐代码
   * 社交媒体按钮 — 您必须将该 ID 添加到您选择包含的每一个单独社交媒体分享按钮中。
3. 在右上角，选择 **保存**.

   <div data-with-frame="true"><figure><img src="/files/366154043967c6dc4cb7b201cb635e01da353fa9" alt="" width="563"><figcaption></figcaption></figure></div>

如需帮助使用编辑器查找并调整您的页面和组件设置，请参阅 [Microsite 编辑器说明](/brand/zh/what-would-you-like-to-learn-about/advocate-program/manage-advocate-participant-experiences/microsite-experiences/microsite-editor-explained.md) 和 [自定义微站点布局和页面](/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. 选择 ![](/files/48274f9251fd79e93a99aad7b4393690b07a61c9) **\[更多]** **→ 删除**.
3. 移除 *已登录布局*.
4. 移除以下页面：
   * 编辑个人资料
   * 电子邮件验证
   * 忘记密码
   * 登录
   * 注销
   * 注册
   * 重置密码
   * 验证电子邮件

</details>
{% endstep %}

{% step %}

#### 步骤 2：生成 JWT

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

您必须在服务器或任何受信任的后端系统上安全地生成 JWT——绝不能在浏览器中生成。

了解如何 [生成 JWT 及其有效载荷要求](https://integrations.impact.com/impact-brand/docs/json-web-tokens).
{% 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 中暴露或操作它。
* 这是一种非标准方法——在正式发布您的项目之前，请先在预发布环境中进行彻底测试。
* 如果您需要 [支持](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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
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>
```

The question should be specific, self-contained, and written in natural language.
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.
