كيفية التعامل مع SSO الخاص بـ Discourse عندما يسمح موقع المصادقة للمستخدمين بتغيير عناوين البريد الإلكتروني؟

نستخدم تدفق SSO الخاص بـ Discourse الذي قمنا بتطبيقه بناءً على هذا الدليل: Setup DiscourseConnect - Official Single-Sign-On for Discourse (sso)

لقد نجح الأمر معنا بشكل جيد. لكننا نريد الآن السماح للمستخدمين في نظامنا بتغيير بريدهم الإلكتروني، ويبدو أن هذا يؤدي إلى مشاكل.

عندما أقوم بتغيير البريد الإلكتروني لمستخدمي في نظامنا، يتوقف عمل SSO مع Discourse.

خطأ في تسجيل الدخول

هناك مشكلة في حسابك. يرجى الاتصال بمدير الموقع.

أظن أن Discourse يستقبل حمولة (payload) تحتوي على بريد إلكتروني واسم مستخدم غير متطابقين ولا يعرف ماذا يفعل.

ما هي الطريقة الجيدة للتعامل مع هذا؟

أفضل فكرة توصلت إليها هي استخدام واجهة برمجة تطبيقات Discourse لتغيير بريد المستخدم الإلكتروني في Discourse ليتطابق مع بريده في نظامنا قبل بدء عملية SSO.

لكنني لا أعرف ما إذا كان ذلك ممكنًا. فيما يلي محاولتي الفاشلة.

إليك طلبي:

https://forum-stage.{domain}.com/users/{username}/preferences/email

Headers:
Content-Type: application/x-www-form-urlencoded
Accept: application/json

Body (as x-www-form-urlencoded in Postman):
email: testemail@testdomain.com
api_key: 75a...77d
api_username: system

وهذه هي الاستجابة التي تلقيتها:

{
    "errors": [
        "You are not permitted to view the requested resource."
    ],
    "error_type": "invalid_access"
}
إعجاب واحد (1)

I’m experiencing this too - did you ever figure out a way around this?

This should not be the case, we primarily key on the SSO id.

You can use the sync sso endpoint to sync the emails on Discourse side if you want to do so proactively but changing emails in your system should always work.

The one exception is

Discourse thinks SSO id is 5 email is bob@jane.com

You log in with SSO id of 6 email is bob@jane.com

This is not resolvable so you will need to manually intervene. (sync sso id 6 first)

إعجاب واحد (1)