discord.py | Access user's connections via an individual OAuth link

Viewed 528

Excuse me if I missed something and this is a duplicate, other QA's still left me with some questions.

I wanted to see if it was possible for my bot to access user connections (Steam acc, Reddit, etc.) so that the user can use a command to enable notifications in a specific channel, so that it would promote when they publish a video.

I've found similar bots, but they all required manual entering and they were admin-only.


I've found that it is NOT possible to directly access them (and rightfully so):

Unfortunately this is not possible when using a "real" bot account, however it is possible if you're using a user bot account.

I'd suggest a workaround of using OAuth2. You could have users authenticate your bot with OAuth2, and then fetch their connections this way. Some more information at https://discordapp.com/developers/docs/topics/oauth2

(Link: https://stackoverflow.com/a/44265167/16255372)

But that last statement about OAuth really got me wondering.

If it is required for each user to authenticate via a link, that is an acceptable compromise for me.

On the discord developers website, I've found a connections scope which would allow the bot to access the connections of the user that authenticated via the link.

I also found a url for getting the user's connections here

Get User Connections

GET /users/@me/connections
Returns a list of connection objects. Requires the connections OAuth2 scope.

But on other sources, I've seen that the scope is inaccessible to bots.

Furthermore, I don't see connections accessible in discord.py, which is what I use.

So my question is + TL;DR:

  1. Is it possible to access the user's connections, even if they each have to click on an oauth link (connections scope)
  2. Would this be possible using discord.py? (potentially using discord.ClientUser?)

Thank you for reading, I am also a new contributor. If you feel that I missed something or could elaborate or explain things better, please let me know how I could improve my question.

1 Answers
  1. Is it possible to access the user's connections, even if they each have to click on an oauth link (connections scope)

YES (only possible using OAuth).

Would this be possible using discord.py? (potentially using discord.ClientUser?)

Unfortunately, no. Discord.PY does not support OAuth. You would have to do it yourself by creating a Web Application etc.

Related