Is there any endpoint that would provide a user's external account IDs from their Discourse ID?

Continuing the discussion from Get external_id by user for associated accounts?:

I saw that this question was asked here, but I don’t think that it got traction since it was only in the dev category. I’m wondering if anything like this exists or is possible, even if it isn’t documented. I really need a way of getting all of their associated accounts, and ideally I wouldn’t want to have to store it in a separate database and have to keep it in sync (e.g. a user removes their social account.)

You can see the info in the admin panel, I think so you can How to reverse engineer the Discourse API.

1 Like

Yeah, so there is an associated_accounts section, but the thing is it doesn’t show the external ID such as what you would need to use with Discourse API Docs which is my problem.

image

For example, I would need to get the Discord user ID or the Steam ID 64 which isn’t accessible from the endpoint.

What is the problem that you’re trying to solve? What are you going to do with the external account info?

I don’t know if there is an API that exposes those. I would have to look at the source. Perhaps someone else does.

You might need a plugin that solves your problem. Maybe just add the info to the user serializer for admins.

1 Like

Yeah, so basically I was using Discourse SSO on an external site and was needing to see if a user has associated their accounts. If they have then I needed their IDs in order to execute certain actions. I just really wanted to avoid having them sign in on that external site with Discord OAuth or Steam OpenID because it seemed redundant and would mean certain things might not be in sync with Discourse.

Well, I still don’t quite understand, but I think you’ll need a plugin.

1 Like

Oh, it’s possible to create a custom api endpoint with a plugin? I’m going to have to look into that. Thank you!

You can create a custom endpoint with that information using How to run Data Explorer queries with the Discourse API

5 Likes

Oh! Wow. Very cool. I knew you could create custom queries and call the from the API, but it hadn’t occured to me that it was an endpoint. Awesome.

4 Likes

Thank you for all the help both of you! It looks like the data explorer might be what I need. I’m going to give that a try right now.

Edit: Yeah, wow - that’s such a powerful plugin. Thank you!

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.