Discourse 使用 DiscourseConnect 调用接口 admin/users/sync_sso 404 错误

在对用户数据通过 SSO 同步的时候,调用提示 404 错误。

我们使用的是 Java 的代码。

2024-05-23_16-34-42

2024-05-23_16-34-421340×802 70.3 KB

如上图,返回显示的代码为 404。

问题原因

出现上面错误的原因是安装的 Discourse 实例的 discourse connect 没有启用。

2024-05-23_16-36-27

2024-05-23_16-36-27928×669 35.3 KB

当这个选项不启用的话,API 调用的同步就会显示 404 没有找到。

启用后的就会显示其他的信息。

下图是当上面的接口调用成功后显示的 200 代码。

2024-05-23_16-39-01

2024-05-23_16-39-011437×833 86.7 KB

API 也会返回一个完整的用户相关数据。

数据结构是 JSON 的。

其实内容还蛮多的,你可以用这个把数据同步回 SSO 单点登录服务器上。

{
  "id": 17,
  "username": "info.visafn.sso",
  "name": "Info Visafn Sso",
  "avatar_template": "/letter_avatar_proxy/v4/letter/i/7ba0ec/{size}.png",
  "active": true,
  "admin": false,
  "moderator": false,
  "last_seen_at": "2024-05-22T20:14:45.926Z",
  "last_emailed_at": "2024-05-22T20:32:54.369Z",
  "created_at": "2024-05-21T18:53:53.081Z",
  "last_seen_age": 87821.707032433,
  "last_emailed_age": 86733.264398046,
  "created_at_age": 179074.552034788,
  "trust_level": 1,
  "manual_locked_trust_level": null,
  "title": null,
  "time_read": 0,
  "staged": false,
  "days_visited": 1,
  "posts_read_count": 0,
  "topics_entered": 0,
  "post_count": 0,
  "can_send_activation_email": true,
  "can_activate": false,
  "can_deactivate": true,
  "ip_address": null,
  "registration_ip_address": null,
  "can_grant_admin": true,
  "can_revoke_admin": false,
  "can_grant_moderation": true,
  "can_revoke_moderation": false,
  "can_impersonate": true,
  "like_count": 0,
  "like_given_count": 0,
  "topic_count": 0,
  "post_edits_count": null,
  "flags_given_count": 0,
  "flags_received_count": 0,
  "private_topics_count": 1,
  "can_delete_all_posts": true,
  "can_be_deleted": true,
  "can_be_anonymized": true,
  "can_be_merged": true,
  "full_suspend_reason": null,
  "silence_reason": null,
  "penalty_counts": {
    "silenced": 0,
    "suspended": 0
  },
  "next_penalty": "2024-05-24T20:38:27.655Z",
  "primary_group_id": null,
  "badge_count": 1,
  "warnings_received_count": 0,
  "bounce_score": 0,
  "reset_bounce_score_after": null,
  "can_view_action_logs": true,
  "can_disable_second_factor": true,
  "can_delete_sso_record": true,
  "api_key_count": 0,
  "external_ids": {},
  "single_sign_on_record": {
    "user_id": 17,
    "external_id": "1",
    "created_at": "2024-05-21T18:53:53.280Z",
    "updated_at": "2024-05-21T18:56:21.866Z",
    "external_username": "info.visafn.sso",
    "external_name": null,
    "external_avatar_url": null,
    "external_profile_background_url": null,
    "external_card_background_url": null
  },
  "approved_by": null,
  "suspended_by": null,
  "silenced_by": null,
  "groups": [
    {
      "id": 10,
      "automatic": true,
      "name": "trust_level_0",
      "display_name": "trust_level_0",
      "user_count": 14,
      "mentionable_level": 0,
      "messageable_level": 0,
      "visibility_level": 1,
      "primary_group": false,
      "title": null,
      "grant_trust_level": null,
      "incoming_email": null,
      "has_messages": false,
      "flair_url": null,
      "flair_bg_color": null,
      "flair_color": null,
      "bio_raw": null,
      "bio_cooked": null,
      "bio_excerpt": null,
      "public_admission": false,
      "public_exit": false,
      "allow_membership_requests": false,
      "full_name": null,
      "default_notification_level": 3,
      "membership_request_template": null,
      "members_visibility_level": 0,
      "can_see_members": true,
      "can_admin_group": true,
      "publish_read_state": false
    },
    {
      "id": 11,
      "automatic": true,
      "name": "trust_level_1",
      "display_name": "trust_level_1",
      "user_count": 14,
      "mentionable_level": 0,
      "messageable_level": 0,
      "visibility_level": 1,
      "primary_group": false,
      "title": null,
      "grant_trust_level": null,
      "incoming_email": null,
      "has_messages": false,
      "flair_url": null,
      "flair_bg_color": null,
      "flair_color": null,
      "bio_raw": null,
      "bio_cooked": null,
      "bio_excerpt": null,
      "public_admission": false,
      "public_exit": false,
      "allow_membership_requests": false,
      "full_name": null,
      "default_notification_level": 3,
      "membership_request_template": null,
      "members_visibility_level": 0,
      "can_see_members": true,
      "can_admin_group": true,
      "publish_read_state": false
    }
  ]
}

Discourse 使用 DiscourseConnect 调用接口 admin/users/sync_sso 404 错误 - Discourse - iSharkFly在对用户数据通过 SSO 同步的时候,调用提示 404 错误。 我们使用的是 Java 的代码。 如上图,返回显示的代码为 404。 问题原因出现上面错误的原因是安装的 Discourse 实例的 discourse connect 没有启用。 当这个选项不启用的话,API 调用的同步就会显示 404 没有找到。 启用后的就会显示其他的信息。 下图是当上面的接口调用成功后显示的 200 代码。 API …icon-default.png?t=N7T8https://www.isharkfly.com/t/discourse-discourseconnect-admin-users-sync-sso-404/15785

  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

HoneyMoose

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值