Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Add auth struct to use with New #651

wants to merge 1 commit into from

Conversation

UlisseMini
Copy link

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 the Auth struct) to get a session.

@@ -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 {
Copy link
Collaborator

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.

Copy link
Author

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.

@Stitch07
Copy link
Contributor

IMO getting rid of email/password login would be a good thing, now that Discord doesn't support it.

@CarsonHoffman
Copy link
Collaborator

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 Bot token scheme would break the use of bearer tokens, and people wanting to self-bot are just going to edit the library anyways.

@bwmarrin
Copy link
Owner

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.

@UlisseMini
Copy link
Author

I agree with @bwmarrin little point to support email/pass auth, it adds a lot more complexity for little gain.

I'm closing, we can continue this in #649

@UlisseMini UlisseMini closed this May 29, 2019
@bwmarrin bwmarrin added this to the N/A milestone Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants