-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add auth struct to use with New
#651
Conversation
@@ -26,6 +26,17 @@ const VERSION = "0.19.0" | |||
// ErrMFA will be risen by New when the user has 2FA. | |||
var ErrMFA = errors.New("account has 2FA enabled") | |||
|
|||
// Auth represents authentication options to use with new. | |||
type Auth struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of this being a PasswordAuth struct, and then having 2 fields. Then have a TokenAuth struct with just one field.
No reason to overload the two methods of authentication again, it was confusing as arguments, I don't want it to be confusing with struct members.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just thought it should have all three, since in the docs for New
it says
With an email, password and auth token - Discord will verify the auth
token, if it is invalid it will sign in with the provided
credentials. This is the Discord recommended way to sign in.
So i thought it would be bad to remove the option of using both.
IMO getting rid of email/password login would be a good thing, now that Discord doesn't support it. |
I personally think that this is over-engineering a solution to support a feature that nobody really uses. Email+password login has been officially unsupported for three years now, and other major libraries have dropped support for it long ago (see discord.py: 2017, discord.js: 2018). I have yet to run into a single person seriously attempting to use it in the time that I've been around this library. I think it would be much simpler to just support a string token, which can be used for bots, bearer tokens, and, yes, self-bots, as although they are against TOS they still hold the same major authentication scheme, and hard-coding a |
Personally, if we're to break the current API on everyone - I'm more in favor of dropping the Email/Pass entirely and just accepting a single token string that we pass along to Discord. It's a closer match to the goal of just being a wrapper around Discord's API and it's simple and easy to use. The only reason this hasn't been done is because of not wanting to break the API on everyone for such a minor thing. Now with modules and versions and such, I do feel better about making breaking changes to help clean up this library. |
WIP This is a proof of concept and not done yet! We need discussion about the API and whether to create a new function / method or to just add it to
New
.I think we should deprecate
New
and add a new function (or method on theAuth
struct) to get a session.