From e634509b7a0c9445f599ae9b31231df98984b467 Mon Sep 17 00:00:00 2001 From: hummingbard Date: Sun, 30 Mar 2025 14:08:14 +0600 Subject: [PATCH 1/3] Missing token_endpoint_auth_method field in upstream sample config for Github --- docs/setup/sso.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/setup/sso.md b/docs/setup/sso.md index 7593737fa..ba43ff2ba 100644 --- a/docs/setup/sso.md +++ b/docs/setup/sso.md @@ -339,6 +339,7 @@ upstream_oauth2: human_name: Google brand_name: "google" issuer: "https://accounts.google.com" + token_endpoint_auth_method: "client_secret_post" client_id: "" # TO BE FILLED client_secret: "" # TO BE FILLED scope: "openid profile email" From e4f83892b9564bd3e95c57f741c762bcd6d65809 Mon Sep 17 00:00:00 2001 From: hummingbard Date: Sun, 30 Mar 2025 15:53:56 +0600 Subject: [PATCH 2/3] Added upstream sample config for Discord, brand logo in templates --- docs/setup/sso.md | 34 +++++++++++++++++++++++++++++ templates/components/idp_brand.html | 2 ++ 2 files changed, 36 insertions(+) diff --git a/docs/setup/sso.md b/docs/setup/sso.md index ba43ff2ba..0dafd9045 100644 --- a/docs/setup/sso.md +++ b/docs/setup/sso.md @@ -452,6 +452,40 @@ upstream_oauth2: template: "{{ user.preferred_username }}" ``` +### Discord + +1. Create a new application in the Discord Developer Portal (see [documentation](https://discord.com/developers/applications)) +2. Add the following "Redirect URI" in the OAuth2 tab under settings: `https:///upstream/callback/` + +Authentication service configuration: + +```yaml +upstream_oauth2: + providers: + - id: 01JQK7DK6VFH62NMW4HS9RKD3R + human_name: Discord + brand_name: "discord" + token_endpoint_auth_method: "client_secret_post" + issuer: "https://discord.com" + client_id: "" # TO BE FILLED + client_secret: "" # TO BE FILLED + fetch_userinfo: true + userinfo_endpoint: "https://discord.com/api/users/@me" + scope: "openid identify email" + claims_imports: + localpart: + action: suggest + template: "{{ user.username }}" + displayname: + action: suggest + template: "{{ user.global_name }}" + email: + action: suggest + template: "{{ user.email }}" + account_name: + template: "{{ user.username }}" +``` + ### Rauthy diff --git a/templates/components/idp_brand.html b/templates/components/idp_brand.html index 9781f09da..e0226c053 100644 --- a/templates/components/idp_brand.html +++ b/templates/components/idp_brand.html @@ -47,5 +47,7 @@ Please see LICENSE in the repository root for full details. + {% elif brand == "discord" %} + {% endif %} {% endmacro %} From 204b7c54b50ed90dad82199a5081817a0819d034 Mon Sep 17 00:00:00 2001 From: hummingbard Date: Sun, 6 Apr 2025 23:21:12 +0600 Subject: [PATCH 3/3] Added Discord to default upstream oauth2 providers, regenerated config schema --- crates/config/src/sections/upstream_oauth2.rs | 1 + docs/config.schema.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/config/src/sections/upstream_oauth2.rs b/crates/config/src/sections/upstream_oauth2.rs index 077e8de02..98b5f3c3c 100644 --- a/crates/config/src/sections/upstream_oauth2.rs +++ b/crates/config/src/sections/upstream_oauth2.rs @@ -432,6 +432,7 @@ pub struct Provider { /// - `github` /// - `gitlab` /// - `twitter` + /// - `discord` #[serde(skip_serializing_if = "Option::is_none")] pub brand_name: Option, diff --git a/docs/config.schema.json b/docs/config.schema.json index 0d8325529..94dcba7ed 100644 --- a/docs/config.schema.json +++ b/docs/config.schema.json @@ -1945,7 +1945,7 @@ "type": "string" }, "brand_name": { - "description": "A brand identifier used to customise the UI, e.g. `apple`, `google`, `github`, etc.\n\nValues supported by the default template are:\n\n- `apple` - `google` - `facebook` - `github` - `gitlab` - `twitter`", + "description": "A brand identifier used to customise the UI, e.g. `apple`, `google`, `github`, etc.\n\nValues supported by the default template are:\n\n- `apple` - `google` - `facebook` - `github` - `gitlab` - `twitter` - `discord`", "type": "string" }, "client_id": {