> 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 令牌（JWT）](https://en.wikipedia.org/wiki/JSON_Web_Token) 在服务器端生成，并通过 URL 参数传递给微站。

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

#### 在开始之前

{% hint style="warning" %}
**重要：** 这是一种高级实现，会绕过微站的标准托管身份服务，且需要您的开发团队提供支持才能设置。
{% 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：创建一个不使用托管身份的微站

当您创建微站时，您需要关闭托管身份服务，然后将所有页面设置为“未验证”用户可访问。该 *仪表板* 页面将使用 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>

有关使用编辑器查找并调整页面和组件设置的帮助，请参阅 [微站点编辑器说明](/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. 选择 ![](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 中暴露或操作它。
* 这是一种非标准方法——在向您的项目正式上线前，请在预发布环境中彻底测试。
* 如果您需要 [支持](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, and the optional `goal` 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>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
