question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DiscordApplication.GenerateBotOAuth does not account for all OAuth scopes

See original GitHub issue

Summary

Using the DiscordApplication.GenerateBotOAuth() method does not allow selecting all scopes to generate an OAuth URI.
It currently only supports the bot scope, and doesn’t support redirect URIs.

Details

Starting from an ideal result of
https://discord.com/api/oauth2/authorize?client_id=583412458560159776&permissions=8&scope=bot applications.commands
This link has scopes bot and applications.commands and permission 0x8 (Administrator) specified.

(Generated from Discord’s OAuth URL Generator tool, using the following settings) image

However, the current method only allows specifying a DSharpPlus.Permissions argument, inferring that the OAuth link will only use the bot scope.

Ideally, we should be able to specify further parameters, like OAuth scopes, and a redirect link, used by other scopes (only bot and applications.commands don’t make use of a redirect).

An ideal implementation would be an overload, or extending the current method, as such:

public string GenerateBotOAuth(
    Permissions permissions = Permissions.None, 
    OAuthScopes scopes = OAuthScopes.Bot, 
    string RedirectUri = null) 
{ /* Implementation */ }

// TODO: Add OAuthScopes enum.

Instead of the current method, found here (source) :

public string GenerateBotOAuth(Permissions permissions = Permissions.None) { /* Implementation */ }

Let it also be known that the current method spars absolutely no documentation whatsoever, so we might want to brush up on that too ^^

Steps to reproduce

N/A

Notes

If maintainers have their hands full, I’d be happy to Fork & PR relevant changes, as well as add documentation to the method, given my first-hand interest in this issue.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
SakuraIsayekicommented, Apr 24, 2022

Just saw the follow-up this morning. I wanted to apologise for bringing this up in the first place, and apologise to you people, especially @VelvetThePanda, as a maintainer. Indeed, this should not’ve been brought up. Not wanting to reiterate such a mistake, I’m ready to renew my support by bringing solid contributions to DSharpPlus, wherever I can.

To conclude, thank you lads/lasses for such a quick conclusion to this issue 😃

1reaction
OoLunarcommented, Apr 24, 2022

Thank you for your apology, I look forward to working with you in the future (if desired)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Discord Developer Portal — Documentation — OAuth2
These are a list of all the OAuth2 scopes that Discord supports. Some scopes require approval from Discord to use. Requesting them from...
Read more >
Missing scopes in the Oauth2 url generators · Issue #5240
Steps to Reproduce. Go to https://discord.com/developers/applications; Click OAuth2 and URL Generator. Expected Behavior. Listed scopes should ...
Read more >
Getting started with OAuth2
Use this to create a URL for yourself with the identify scope. Generate an OAuth2 URL. The identify scope will allow your application...
Read more >
how to fix DiscordAPIError[50001] OAuth2 problem?
Go to the Discord Developer Portal and find your application. Go to OAuth2 > URL Generator. Select the bot and applications.commands scopes (be ......
Read more >
OAuth2 w/ Discord From Scratch #1 - YouTube
Code: https://github.com/stuyy/ discord - oauth2 -implementation In this tutorial, we will implement OAuth2.0 with Discord as our provider.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found