# 稳定版v2.8.10：SSO邀请链接（接受邀请按钮）失效

**URL:** https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945
**Category:** Bug
**Tags:** sso, invites
**Created:** [2022 年11 月 9 日 00:48 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945 "2022-11-09T00:48:26Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### 作者： ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### 发布日期： [2022 年11 月 9 日 00:48 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/1 "2022-11-09T00:48:27Z")

</div>

您好 Discourse 团队，

在稳定版 v.2.8.10 上，“接受邀请”按钮无法正常工作。当您尝试通过 SSO 登录时，它只会将您重定向回邀请页面，而“接受邀请”按钮没有任何反应。控制台中也没有显示任何错误。有人能帮忙吗？

我认为这与最新的更新有关：[SECURITY: Fix invite link validation (stable) (#18818) · discourse/discourse@7e4e8c8 · GitHub](https://github.com/discourse/discourse/commit/7e4e8c8ad21e87b39e14837004ef60f85c4ccfb8)

谢谢

---

<div class="post-metadata">

### 作者： ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### 发布日期： [2022 年11 月 9 日 03:15 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/2 "2022-11-09T03:15:37Z")

</div>

能否确认一下您的网站是如何配置的？

启用 SSO 后，邀请功能历史上一直无法正常工作。这可能是一个回归问题，但我们需要了解更多信息。

---

<div class="post-metadata">

### 作者： ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### 发布日期： [2022 年11 月 9 日 03:43 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/3 "2022-11-09T03:43:38Z")

</div>

您好 @Stephen ，

感谢您的回复！您具体需要什么信息？我们使用的是 `discourse-saml` 插件，通过 Okta（SSO）在稳定分支（v2.8.10）上进行自托管。在更新到 2.8.10 之前，我们能够创建发往群组的邀请链接，并且它们能够正常工作，用户通过 SSO 登录后，会被重定向到邀请设置中指定的帖子。

---

<div class="post-metadata">

### 作者： ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### 发布日期： [2022 年11 月 9 日 06:18 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/4 "2022-11-09T06:18:34Z")

</div>

附加信息：

在之前的稳定版本 v2.8.9 中，访问 `domain.com/invites/invitecode` 时：

- 未登录用户将看到一个屏幕，要求他们通过 SSO（在 app.yml SAML 配置中指定的 Okta）登录，这将把他们重定向到 SSO 进行登录/注册，之后将执行邀请操作（重定向到主题、添加到组等）。

- 已登录用户将自动绕过邀请屏幕，并执行邀请操作。

在当前稳定版本 v2.8.10 中，访问 `domain.com/invites/invitecode` 时：

- 未登录和已登录用户都将看到带有两个按钮的邀请屏幕：  
– 通过 SSO 登录按钮  
– 接受邀请（这是新功能）

点击“通过 SSO 登录”按钮后，系统会提示用户登录（如果尚未登录），然后将用户重定向回邀请页面。  
点击“接受邀请”按钮后，没有任何反应。

我们在网络浏览器控制台中观察到，有一个 `PUT` 请求到 `domain.com/invites/show/invitecode.json`，该请求返回 504 错误（仅在 2.8.10 版本中）。

---

<div class="post-metadata">

### 作者： ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### 发布日期： [2022 年11 月 9 日 10:25 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/5 "2022-11-09T10:25:47Z")

</div>

我可以将此移至某个类别以报告此错误吗？

---

<div class="post-metadata">

### 作者： ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### 发布日期： [2022 年11 月 10 日 01:17 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/8 "2022-11-10T01:17:27Z")

</div>

确认我们已了解该问题，您能否确认该问题 **并非** 出在 tests-passed 环境，而仅存在于 stable 环境中？

---

<div class="post-metadata">

### 作者： ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### 发布日期： [2022 年11 月 10 日 02:18 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/9 "2022-11-10T02:18:05Z")

</div>

你好 @sam ，

感谢您的回复！很高兴得知您已了解该问题。

遗憾的是，我们没有一个带有 SSO 的测试通过实例，因为我们一直坚持使用稳定版。我有一个不带 SSO 的测试通过分支，那里没有问题。

编辑：我将尝试运行一个带有 SSO 的测试通过实例。

---

<div class="post-metadata">

### 作者： ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### 发布日期： [2022 年11 月 10 日 06:27 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/10 "2022-11-10T06:27:06Z")

</div>

嘿 @sam，

我成功启动了一个 `tests-passed` 实例，并且在我这边没有遇到问题。  
能够接受邀请。希望这能帮到你！

---

<div class="post-metadata">

### 作者： ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### 发布日期： [2022 年11 月 10 日 21:20 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/11 "2022-11-10T21:20:41Z")

</div>

嗨 @sam！

有没有可能将稳定版移植回来，以便在稳定版上进行修复？

---

<div class="post-metadata">

### 作者： ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### 发布日期： [2022 年11 月 14 日 06:05 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/12 "2022-11-14T06:05:18Z")

</div>

我看到 Discourse 有一个更新：[2.8.11: Security Release](https://meta.discourse.org/t/2-8-11-security-release/245470)

这个更新有可能修复这个问题吗？🙂

---

<div class="post-metadata">

### 作者： ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### 发布日期： [2022 年11 月 15 日 22:05 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/13 "2022-11-15T22:05:30Z")

</div>

是的，我们会更新，非常感谢您的报告，完成后我们会通知您。请给我们一到两周的时间。

---

<div class="post-metadata">

### 作者： ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### 发布日期： [2022 年11 月 15 日 22:11 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/14 "2022-11-15T22:11:14Z")

</div>

太棒了！谢谢你，@sam！ 🙌

编辑：  
供其他可能遇到此问题的人参考：

稳定版 2.8.11 并没有修复此问题。现在点击“接受邀请”会输出一个控制台日志错误：  
`PUT https://<DOMAIN>/invites/show/<INVITE_CODE>.json 404`  
.json URL 指向：

```plaintext
// https://<DOMAIN>/invites/show/<INVITE_CODE>.json

{
  "errors": [
    "找不到请求的 URL 或资源。"
  ],
  "error_type": "not_found"
}

```

---

<div class="post-metadata">

### 作者： ![martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin/32/491371_2.png) [@martin](https://meta.discourse.org/u/martin)
#### 发布日期： [2022 年11 月 16 日 04:44 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/16 "2022-11-16T04:44:52Z")

</div>

您好 @hyphalos，我今天开始查看这个问题。我对我们的 SAML 设置不太熟悉，请您多包涵。

> [@hyphalos](#):
>
> 未登录和已登录用户都将看到邀请屏幕，上面有 2 个按钮：  
> – 通过 SSO 按钮登录  
> – 接受邀请（这是新的）

这有点奇怪，“接受邀请”按钮应该只显示给已登录用户。您能否发布一张截图，显示已登录和未登录用户看到的特定邀请，以及您在此处为邀请选择的选项：

 ![image](https://global.discourse-cdn.com/meta/original/4X/1/8/5/185c4f32aa41121c0e30c69783cbf16004633b5c.png)

---

<div class="post-metadata">

### 作者： ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### 发布日期： [2022 年11 月 22 日 22:09 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/18 "2022-11-22T22:09:42Z")

</div>

你好 @martin！

感谢你的回复。抱歉回复晚了，我之前生病了。

我做了进一步的测试，发现更新到 `v2.8.11` 后，无论创建邀请的设置如何，人们都只能接受一次邀请。我测试了“到达主题”、“不到达主题”、“添加到组”、“不添加到组”等设置，人们都只能接受一次邀请。这是预期的行为吗？

如果访客注册但再次使用相同的邀请 URL，他们将卡在邀请页面（不重定向到“到达主题”）。当他们点击“接受邀请”时，会弹出此错误：

> [@Invite links (Accept Invitation Button) with SSO not working for stable v2.8.10](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/14):
>
> That’s awesome! Thanks @sam ! raised_hands EDIT: Just an FYI for others who may be experiencing this: Version 2.8.11 of stable does not fix the issue. Clicking on Accept Invitation spews out a console log error now though: PUT https://\<DOMAIN\>/invites/show/\<INVITE\_CODE\>.json 404 The .json url takes you to: // https://\<DOMAIN\>/invites/show/\<INVITE\_CODE\>.json { "errors": ["The requested URL or resource could not be found."], "error\_type": "not\_found" }

编辑：我想补充一点，如果这是预期的行为，那么不会出现“您之前已接受此邀请”之类的错误提示，或者只是重定向到邀请中设置的“到达主题”位置。

---

<div class="post-metadata">

### 作者： ![martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin/32/491371_2.png) [@martin](https://meta.discourse.org/u/martin)
#### 发布日期： [2022 年11 月 24 日 00:37 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/19 "2022-11-24T00:37:21Z")

</div>

> [@hyphalos](#):
>
> 我进行了更多测试，我观察到更新到 `v2.8.11` 后，无论创建邀请设置如何，人们都只能接受一次邀请。我测试了“到达主题”、“不到达主题”、“添加到组”、“不添加到组”等选项，人们都只能接受一次邀请。这是预期行为吗？
> 
> 如果访客注册但再次使用相同的邀请 URL，他们将卡在邀请页面（不重定向到“到达主题”）。当他们点击“接受邀请”时，会弹出此错误

是的，这是预期的。不是错误，而是无法多次接受邀请的部分。我们在 [New 'accept invitation' prompt feature causing issues with invitation links - #14 by martin](https://meta.discourse.org/t/new-accept-invitation-prompt-feature-causing-issues-with-invitation-links/245115/14?u=martin) 讨论过这个问题，我进行了一次修复，但现在我看到需要将该修复反向移植到 `stable` 版本，cc @sam

---

<div class="post-metadata">

### 作者： ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### 发布日期： [2022 年11 月 24 日 01:11 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/20 "2022-11-24T01:11:07Z")

</div>

嗨 @martin，太棒了，感谢您的调查！

---

<div class="post-metadata">

### 作者： ![martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin/32/491371_2.png) [@martin](https://meta.discourse.org/u/martin)
#### 发布日期： [2022 年11 月 28 日 05:15 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/21 "2022-11-28T05:15:24Z")

</div>

我刚刚将此修复提交到了 `stable` 版本，链接如下：

> <https://github.com/discourse/discourse/pull/19218>
>
> Backports the following:
> 
> \* 40e8912395ee2dc0f43c2b2a4504f4984c1f040d
> \* bbcb69…461fd85af0e1d883cfbc8240c200e748e9
> 
> Which were showing an error when users were
> trying to claim invites multiple times and
> a subsequent follow-up fix.

---

<div class="post-metadata">

### 作者： ![hyphalos](https://avatars.discourse-cdn.com/v4/letter/h/3ab097/32.png) [@hyphalos](https://meta.discourse.org/u/hyphalos)
#### 发布日期： [2022 年11 月 29 日 03:32 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/22 "2022-11-29T03:32:10Z")

</div>

嘿 @martin！

再次感谢您的修复！

我已经更新到 2.8.12（根据管理员面板中的 [commit tag](https://github.com/discourse/discourse/commits/27d93b46582002bd07f672c8759a96771aa977f3)，其中包含修复程序），现在我看到一个错误消息（在一个测试账户上），提示尝试接受一个我曾经在该测试账户上接受过的邀请：

 ![sso-button](https://global.discourse-cdn.com/meta/original/4X/a/6/d/a6d8da0dca3794283e4af11cea718ef08661ca89.png)

这很棒！

不过，作为已经登录的用户，我没想到会显示“Okta SSO”按钮。当点击该按钮时，它会循环进入 SSO，然后将我带回到邀请页面。既然用户已经登录，是否应该隐藏登录按钮以避免混淆？

---

<div class="post-metadata">

### 作者： ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### 发布日期： [2022 年12 月 2 日 21:00 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/23 "2022-12-02T21:00:24Z")

</div>

此主题已在 4 天后自动关闭。不再允许回复。

---

<div class="post-metadata">

### 作者： ![martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin/32/491371_2.png) [@martin](https://meta.discourse.org/u/martin)
#### 发布日期： [2022 年12 月 8 日 06:39 UTC](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945/24 "2022-12-08T06:39:43Z")

</div>



[下一页](https://meta.discourse.org/t/invite-links-accept-invitation-button-with-sso-not-working-for-stable-v2-8-10/244945.md?page=2)
