zacholade / Rift-Companion

1 stars 0 forks source link

Oauth2 #5

Open zacholade opened 5 years ago

zacholade commented 5 years ago

https://discussion.developer.riotgames.com/questions/6153/oauth-for-league-of-legends-account.html

"We're are actively working on an OAuth solution for third party developers but we don't have an ETA on when that work will be completely/ready for use. There will be an announcement when we've got more to share, you can follow announcements here either on our forums or via Twitter."

When implemented, we will investigate adding this to the bot instead of a simple "iam" command.

zacholade commented 5 years ago

https://github.com/pseudonym117/Riot-Watcher/blob/master/src/riotwatcher/_apis/ThirdPartyCodeApiV3.py

Edit. There is a verification system in place and the riotwatcher wrapper has been speedy to implement this. (It was literally just implemented haha)

zacholade commented 5 years ago

I must be dumb... Discord literally lets you add your league of legends account through oauth2 to discord and it will show up in your user connections just like your skype, spotify, netflix account and all will. Poggers Screenshot from Gyazo Screenshot from Gyazo

Using this data, we could also calculate what champions are most picked. Screenshot from Gyazo

zacholade commented 5 years ago
Ignoring exception in on_ready
Traceback (most recent call last):
  File "/home/zachy/.local/lib/python3.6/site-packages/discord/client.py", line 220, in _run_event
    await coro(*args, **kwargs)
  File "bot.py", line 84, in on_ready
    profile = await user.profile()
  File "/home/zachy/.local/lib/python3.6/site-packages/discord/user.py", line 600, in profile
    data = await state.http.get_user_profile(self.id)
  File "/home/zachy/.local/lib/python3.6/site-packages/discord/http.py", line 210, in request
    raise Forbidden(r, data)
discord.errors.Forbidden: FORBIDDEN (status code: 403): Bots cannot use this endpoint

Well turns out this idea is down the drain.

https://discordpy.readthedocs.io/en/rewrite/api.html#discord.User.profile

zacholade commented 5 years ago

https://discordapp.com/developers/docs/topics/oauth2 Nevermind.. It is possible to authorise the bot via oauth2 however I think this should come in a later release due to the strenuous efforts needed to implement oauth2 code for token grant. discord.py library does not have oauth2 support and we would need to implement this ourselves.

Pog idea but we can wait.

zacholade commented 5 years ago

Idea implemented in https://github.com/Zachy24/Rift-Companion/commit/854b69e71f5f9884df1be1d57e58ecfdb14bfbdb:

TODO: