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": { diff --git a/docs/setup/sso.md b/docs/setup/sso.md index 7593737fa..0dafd9045 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" @@ -451,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 @@ + {% elif brand == "discord" %} + {% endif %} {% endmacro %}