Qualcuno sa come ottenere l’“external_id” di un utente dall’API? Ho aggiunto un external_id durante l’accesso SSO, ma ora, quando interrogo gli utenti, non vedo alcun “external_id” nell’hash utente restituito dall’API. Sto cercando di utilizzare l’external_id per identificare gli utenti dal mio database durante l’elaborazione di un webhook.
Yes, this can be done by sending an authenticated GET request to https://discourse.example.com/u/by-external/{external_id}.json
This route is documented here: Discourse API Docs.
2 Mi Piace
And to get the inverse (ie obtain the external_id given a user_id) you can either:
-
Use the Discourse Ruby API and call the method: user_sso(user_id)
-
Send an authenticated get request to:
https://discourse.example.com/admin/users/{id}.json
and look for hash key [“single_sign_on_record”][“external_id”]
Note that single_sign_on_record (and external_id) is NOT returned by a call to:
https://discourse.example.com/users/{username}.json
2 Mi Piace
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.