I am happily using SSO and the Discourse API on my site. I now want to extend it much further, by enabling all my existing Groups to have a private subforum within my Discourse forum (I have just written a howto about that, since most of the API involved is poorly documented). This however raises the problem that not all of my users have logged into the forum so far, and login is exclusively via SSO, so it is likely that some Group members don’t have forum names. In order to nevertheless be able to assign them to a certain forum group, I’d like to pre-create their user accounts. How do I do that? I mean, there is an API for creating Discourse users, but how would I ensure that, if I create an account for Mark, that when Mark eventually signs into the forum, the SSO signs him into the account that I created for him and not a new one? Thanks!
5 Likes
SSO users are matched by external_id and if that does not exist or match, by email address.
So if you make sure that one of those (preferably the external_id) matches, you’ll be alright.
4 Likes
Turns out that the POST /users path was impossible and I needed Sync SSO user data with the sync_sso route which is quite a bit more complicated, for no good reason. Anyway it’s done.
3 Likes