I am trying to write a function to import all existing users from our external site (3rd party i am only making the middleware) and i am trying to the createUser function. It works fine, except for the external_ids parameter. No matter what i send in it (i tried arrays, objects… you name it) the external id is not saved but the user is created. No errors.
Is there any specific format for the external_ids object?
I saw the sso_sync solution but i would rather not go down that path, especially that the external_ids param is included in the API.
I have already set up SSO, and was able to redirect from the 3rd party site to discourse, but i do not recall any place to define the provider except when defining discourse connect provider secrets. Is there something i am missing?
Hmm, ok. If you’re using DiscourseConnect, from reading the code, it looks like you can’t add the external id when creating. The code just above only handles associated accounts which are different from SSO.
Can you try making two calls: first call the same as you have now, but without the external ids, and add a second call to updateUser, including the external id info? Hopefully that works.
Thank you for your help, and yes i am using DiscourseConnect which is probably why this isn’t working. I think this is the approach I will end up having to do. Either that or I have to make a second call that SSO logins the user with the external id so that it is linked to their email.
Edit: I think the updateUser will also have the same issue as i do not have a defined provider, so probably the SSO login is my best bet.
So just to update and close this, the only solution that worked was running sso_sync after creating a new user, and even that was not very necessary because once the user tries to sso into discourse the sync will happen anyways via email it seems.
Thanks for all who helped.