Hi there. I’m trying to implement the auto account injection for the TALK. One feature that @michael mentioned that would sync all the OpenMRS ID to TALK.
My plan is:
Store existing accounts that not stored yet in TALK.
Make sure future accounts will be stored in TALK when they finished their registrations, and sync all the modification synchronously.
As this is somehow an important feature that should be deployed ASAP. I need to know the current version of Dashboard in production, i.e. the commit hash code.
And for the sake of error-free, I’m wondering is all the accounts’ username in TALK are the same as their OpenMRS ID. It will be easier for me to check the existence of a user.
Based on this documentation, the idea is that a POST to Discourse end point /admin/users/sync_sso can be used to update details of the user when details are changed in Dashboard. The data sent should be basically the same that is sent for the log in process.
Also there is an endpoint that provides details on the status of the user such as: https://talk.openmrs.org/users/by-external/michael.json. This uses the external_id that we send it (the OpenMRS ID). There are some cases where the user name in Discourse is not the same because there can’t be . in the user ID in Discourse. But the official OpenMRS ID is still maintained in this external_id.
Take a look and in case of further questions, let’s just keep this topic going.
Yep, unfortunately the Discourse API’s are not yet very well documented (kind of like OpenMRS!) so it takes a lot of research to find what really needs to happen. But we’ll also see what answers come to your meta question.
@michael@r0bby
I’ve made a PR here for this issue. It will sync the changes with TALK.
At last I’ve chosen to imitate the normal login procedure. Go to the login URL and fetch the nonce (temporary credence for SSO login) and make a request to issue that login. As Discourse will sync the data during login, this will work magically.
And for efficiency, all the HTTP requests are just HEAD requests.
This has been the behavior all along. We want the Discourse account created before the user first signs in to Discourse – instead, when their account is created or updated on Dashboard.