-
Notifications
You must be signed in to change notification settings - Fork 939
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 thirdparty Discord provider (OAuth 2.0) #1279
Conversation
I've generated the JSON Schema and added tests. Apologies on the lack of tests at first, I didn't see those tests in the |
s.Equal("discord", identity.ProviderName) | ||
s.Equal("discord_abcde", identity.ProviderID) | ||
|
||
logs, lerr := s.Storage.GetAuditLogPersister().List(0, 0, nil, nil, []string{"thirdparty_signin_succeeded"}, user.ID.String(), "", "", "") |
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.
This one still counts as a sign up because no user with an appropriate identity exists. Hence the logs are empty (because it looks for an event with a different key, i.e. signin
instead of signup
) and the test fails. To accomplish this you would need an existing user.
The test suite runs a postgres container and uses fixtures to populate the database with data for the test. So, in order for this to work you'd have to add an existing user with the required data (see the link above for examples).
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.
Hi @plunkettscott, what's the status on this? We're about to make some slight changes to the third party stuff, which most likely also affects some of the tests. Would be great if we could merge this PR before merging the third party changes so that you don't have to bother with any more changes.
Closing in favour of #1353 |
Description
This PR adds the Discord OAuth provider in order to support authentication via Discord.
Tests
I have tested the OAuth flow using Discord and all features worked as expected.
Implementation
I've copied the existing Google provider, however, Discord avatar URLs have to be built based on a returned hash. I implemented this functionality on the Discord provider itself even though it does not rely on any other provider functionality in order to keep the top-level API footprint of the package low.
In addition, I've also setup the Discord icon in the frontend elements and updated the configuration documentation to reflect the new
third_party.providers.discord
config object.Todos
The documentation site still needs to be updated. I didn't update the
docs/
within this repository as it doesn't seem to be the currently active documentation site. If I need to update the docs within this repository, please let me know.