Is there a way to insert a row inside the user_associated_account
table from the REST API ?
To give you some context, I need to be able to create users on our Discourse instance and link them to our OAuth2 provider.
When users logs in from the Discourse UI (through OAuth2 Basic Plugin), their account is linked and I can get their discourse user ID from their external UID with GET /u/by-external/oauth2_basic/{external_uid}
.
However, when we create users from the REST API (POST /users.json
), I see no way to link their account to their corresponding OAuth2 account (if they don’t manually log in on Discourse).
FYI, OAuth2 basic plugin implemented the new Auth::ManagedAuthenticator
system : Move to ManagedAuthenticator by angusmcleod · Pull Request #21 · discourse/discourse-oauth2-basic · GitHub
What I tried :
- I looked into the API docs and did not find any clue.
- I found which API route was called to get the associated accounts from one user :
GET /u/{username}/emails.json
. But this route does not seems to support HTTPPUT
method and does not expose the fields from theuser_associated_accounts
table (provider_name
,provider_uid
anduser_id
). - I also looked into the Discourse settings if anything was related to this issue without any success.
- I checked on meta.discourse.org and did not found a solution.
Any help is greatly appreciated! Thanks