Wordpress / discourse 集成无法连接

我很难让 WordPress 连接到 Discourse(我的安装在这里 forum.employ.com),这是我的错误消息:

[2023-11-07 19:14:56] connection.INFO: check_connection_status.failed_to_connect {"error":"wpdc_response_error","message":"An invalid response was returned from Discourse","http_code":403,"http_body":"{\"errors\":[\"You are not permitted to view the requested resource. The API username or key is invalid.\"],\"error_type\":\"invalid_access\"}"} 
[2023-11-07 19:15:11] connection.INFO: check_connection_status.failed_to_connect {"error":"wpdc_response_error","message":"An invalid response was returned from Discourse","http_code":403,"http_body":"{\"errors\":[\"You are not permitted to view the requested resource. The API username or key is invalid.\"],\"error_type\":\"invalid_access\"}"} 
[2023-11-07 19:15:35] connection.INFO: check_connection_status.failed_to_connect {"error":"wpdc_response_error","message":"An invalid response was returned from Discourse","http_code":403,"http_body":"{\"errors\":[\"You are not permitted to view the requested resource. The API username or key is invalid.\"],\"error_type\":\"invalid_access\"}"} 
[2023-11-07 19:16:18] connection.INFO: check_connection_status.failed_to_connect {"error":"wpdc_response_error","message":"An invalid response was returned from Discourse","http_code":403,"http_body":"{\"errors\":[\"You are not permitted to view the requested resource. The API username or key is invalid.\"],\"error_type\":\"invalid_access\"}"} 
[2023-11-07 19:16:51] connection.INFO: check_connection_status.failed_to_connect {"error":"wpdc_response_error","message":"An invalid response was returned from Discourse","http_code":403,"http_body":"{\"errors\":[\"You are not permitted to view the requested resource. The API username or key is invalid.\"],\"error_type\":\"invalid_access\"}"} 
[2023-11-07 19:55:28] connection.INFO: check_connection_status.failed_to_connect {"error":"wpdc_response_error","message":"An invalid response was returned from Discourse","http_code":403,"http_body":"{\"errors\":[\"You are not permitted to view the requested resource. The API username or key is invalid.\"],\"error_type\":\"invalid_access\"}"} 
[2023-11-07 19:57:56] connection.INFO: check_connection_status.failed_to_connect {"error":"wpdc_response_error","message":"An invalid response was returned from Discourse","http_code":403,"http_body":"{\"errors\":[\"You are not permitted to view the requested resource. The API username or key is invalid.\"],\"error_type\":\"invalid_access\"}"} 

我已经正确创建了密钥,所以不太确定接下来该怎么做……有什么想法吗?

  • Jake
1 个赞

您是如何创建 API 用户名和密钥的?用户级别范围
根据文档:

  • 用户名应该是 Discourse 的管理员用户。
  • 范围应设置为 全局

您能确认您做得对吗?

2 个赞


我认为我们已经正确地完成了设置。

雇佣礼宾服务

这是你的问题!你应该输入用户名,而不是名字
用户名是唯一的,没有空格。

2 个赞

我已经试过了,现在会再试一次,你的意思是用户名只能是一个单词,对吗?

是的,您可以在您的 Discourse 上查看该用户的个人资料。您可以看到显示的用户名(也可以查看 URL)。

例如:

好的,所以我不希望使用我的名字……我猜我必须在 discourse 中创建一个更通用的管理员名字,对吗?

当然可以,您可以创建另一个管理员用户。 :slight_smile:

1 个赞

正如 @Arkshine 所指出的,发布用户名需要设置为管理员用户的 用户名,而不是他们的全名。

你没有在此处发布你的完整 API 密钥,但你需要非常小心发布任何包含你的 Discourse 站点的 API 密钥的内容。如果这是我的站点,我可能会立即生成一个新的 API 密钥,并更新 WordPress 上的 API 密钥设置以使用新密钥。

@angus,在插件界面中屏蔽 API 密钥设置的值是否有意义?这样做可能会突出显示密钥需要受到保护的事实。这也将更容易发布插件连接状态页面的屏幕截图。

3 个赞

谢谢 Simon,是的,我创建了另一个,所以那没问题。

如果 discourse 插件的文档中关于 discourse 用户名能更清楚一些会很有帮助,可能很多人尝试后就放弃了,懒得过来这里问。你可以像这个帖子中那样,给出一个 URL 示例以及如何找到它……

2 个赞

很高兴您已解决 @Jacob_Peebles 的问题。

如连接视频和文档中所述,最简单的做法就是将用户名保留为默认的 system

如果您选择更改此设置,则确实需要使用另一个用户名。

我已在文档中添加了一行,说明在哪里可以找到用户的用户名。

由于我将系统重命名为与我们的品牌(已发布帖子的用户)相关的内容,但更新却将其名称恢复了。这会破坏与 WP 的连接……

您好 @Firsh,很抱歉您遇到了问题。您能否在 Support > WordPress 中创建一个新主题,并更详细地描述您遇到的问题?您采取的步骤、预期的行为以及任何日志、屏幕截图和相关链接。谢谢!

这和之前说的一样,这个话题确实有助于阐明这个问题。就像楼主一样,我的发布者(用户名)字段里也写了一些非标准的内容。

我明白了。所以你们解决了这个问题?

但是我也开了那个话题,因为用户名恢复是另一个问题(如果其他人也意外的话),这仅仅是一个副作用。

1 个赞