Skip to content

Commit

Permalink
added discord as know oidc provider
Browse files Browse the repository at this point in the history
  • Loading branch information
romanziske committed Oct 30, 2023
1 parent 8d6d112 commit 255c9c4
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
Binary file added docs/src/main/asciidoc/images/oidc-discord-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/src/main/asciidoc/images/oidc-discord-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions docs/src/main/asciidoc/security-openid-connect-providers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,26 @@ quarkus.oidc.client-id=<Client ID>
quarkus.oidc.credentials.client-secret.value=<Client Secret>
----

[[discord]]
=== Discord

Create a https://discord.com/developers/applications[Discord application]:

image::oidc-discord-1.png[role="thumb"]

You now can get your client id and secret:

image::oidc-discord-2.png[role="thumb"]

You can now configure your `application.properties`:

[source,properties]
----
quarkus.oidc.provider=discord
quarkus.oidc.client-id=<Client ID>
quarkus.oidc.credentials.client-secret=<Client Secret>
----


[[provider-scope]]
== Provider scopes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,7 @@ public static enum ApplicationType {

public static enum Provider {
APPLE,
DISCORD,
FACEBOOK,
GITHUB,
GOOGLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public static OidcTenantConfig provider(OidcTenantConfig.Provider provider) {
switch (provider) {
case APPLE:
return apple();
case DISCORD:
return discord();
case FACEBOOK:
return facebook();
case GITHUB:
Expand Down Expand Up @@ -163,4 +165,18 @@ private static OidcTenantConfig twitch() {
ret.getCredentials().getClientSecret().setMethod(Method.POST);
return ret;
}

private static OidcTenantConfig discord() {
// Ref https://discord.com/developers/docs/topics/oauth2
OidcTenantConfig ret = new OidcTenantConfig();
ret.setAuthServerUrl("https://discord.com/api/oauth2");
ret.setDiscoveryEnabled(false);
ret.setAuthorizationPath("authorize");
ret.setTokenPath("token");
ret.getAuthentication().setScopes(List.of("identify", "email"));
ret.getAuthentication().setIdTokenRequired(false);
ret.getToken().setVerifyAccessTokenWithUserInfo(true);
ret.setUserInfoPath("https://discord.com/api/users/@me");
return ret;
}
}

0 comments on commit 255c9c4

Please sign in to comment.