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
feat: adds discord oidc provider #767
Conversation
0f4c40b
to
e598bcb
Compare
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.
Let me think about how to test this stuff tomorrow. But looks good, thanks for adding the documentation 👍
import ( | ||
"context" | ||
"fmt" | ||
"github.com/bwmarrin/discordgo" | ||
"github.com/ory/herodot" | ||
"github.com/ory/x/stringslice" | ||
"github.com/ory/x/stringsx" | ||
"github.com/pkg/errors" | ||
"golang.org/x/oauth2" | ||
"net/url" | ||
) |
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.
Looks like you didn't run make format
?
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.
Yeah... make format
seems to use lintx...when I try to install lintx it wants to install setupdocx, which has a dependency on setuplibs which has (how it looks to me) again a circular dependency on setupdocx... I think i have to do this tomorrow.
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.
Normally my IDE formats everything correct but not this time haha
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.
you have to
$ go install github.com/sqs/goreturns
goreturns just orders imports differently than the default by grouping them
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.
Done. Somehow github.com/ory/x/tools/listx
was not installed and I thought lintx was this. But it seems lintx is supposed to be installed automatically?
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.
There are some hacks in the Makefile but it does not work for me reliably either....
Hmm... I just found out that the discordgo library uses the API version v6 of discord, but it is already deprecated and the current version is v8: Discord Reference. And the issuer url is also hardcoded to v6. That could be problematic when they stop v6 in the near future. |
Do you think that discordgo will update to v8? That would be the best approach, even if they do it later on. |
Yeah they will probably update it. But we should not forget to update once it uses v8 by default. |
Looks like the authentication URLs do not strictly require the API version. They will probably always work without the version: https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-urls |
Looks like the URL without an explicit version will always point to the default? So it should always work. Maybe add a PR to discordgo to use the authentication URL without a version? |
Yes, but we use the /users/@me endpoint where we need the api version: https://discord.com/api/v6/users/@me |
Alright, let's continue with this as is. We can open an issue in discordgo that request v8 support and add the issue URL in a code comment. https://github.com/ory/closed-reference-notifier will tell us when the issue is resolved 😉 |
Awesome 🎉 Thank you for your contribution! |
Related issue
Closes #533
Closes #534
Proposed changes
Adds discord as an oidc provider. This is a continuation of the stale PR #534.
Checklist
vulnerability. If this pull request addresses a security. vulnerability, I
confirm that I got green light (please contact
security@ory.sh) from the maintainers to push
the changes.
works.
Further comments
I will improve the documentation with further direct code references once we have a final commit id or release.