Skip to content

Commit a4ab2ef

Browse files
authored
Add Discord as a default upstream oauth2 provider, Add missing token_endpoint_auth_method field in Github sample config (#4310)
2 parents bcaa783 + 65f4c4d commit a4ab2ef

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

crates/config/src/sections/upstream_oauth2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ pub struct Provider {
432432
/// - `github`
433433
/// - `gitlab`
434434
/// - `twitter`
435+
/// - `discord`
435436
#[serde(skip_serializing_if = "Option::is_none")]
436437
pub brand_name: Option<String>,
437438

docs/config.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1945,7 +1945,7 @@
19451945
"type": "string"
19461946
},
19471947
"brand_name": {
1948-
"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`",
1948+
"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`",
19491949
"type": "string"
19501950
},
19511951
"client_id": {

docs/setup/sso.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ upstream_oauth2:
339339
human_name: Google
340340
brand_name: "google"
341341
issuer: "https://accounts.google.com"
342+
token_endpoint_auth_method: "client_secret_post"
342343
client_id: "<client-id>" # TO BE FILLED
343344
client_secret: "<client-secret>" # TO BE FILLED
344345
scope: "openid profile email"
@@ -451,6 +452,40 @@ upstream_oauth2:
451452
template: "{{ user.preferred_username }}"
452453
```
453454

455+
### Discord
456+
457+
1. Create a new application in the Discord Developer Portal (see [documentation](https://discord.com/developers/applications))
458+
2. Add the following "Redirect URI" in the OAuth2 tab under settings: `https://<auth-service-domain>/upstream/callback/<id>`
459+
460+
Authentication service configuration:
461+
462+
```yaml
463+
upstream_oauth2:
464+
providers:
465+
- id: 01JQK7DK6VFH62NMW4HS9RKD3R
466+
human_name: Discord
467+
brand_name: "discord"
468+
token_endpoint_auth_method: "client_secret_post"
469+
issuer: "https://discord.com"
470+
client_id: "<client-id>" # TO BE FILLED
471+
client_secret: "<client-secret>" # TO BE FILLED
472+
fetch_userinfo: true
473+
userinfo_endpoint: "https://discord.com/api/users/@me"
474+
scope: "openid identify email"
475+
claims_imports:
476+
localpart:
477+
action: suggest
478+
template: "{{ user.username }}"
479+
displayname:
480+
action: suggest
481+
template: "{{ user.global_name }}"
482+
email:
483+
action: suggest
484+
template: "{{ user.email }}"
485+
account_name:
486+
template: "{{ user.username }}"
487+
```
488+
454489

455490
### Rauthy
456491

templates/components/idp_brand.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,7 @@
4747
<svg class="{{ class }}" xmlns="http://www.w3.org/2000/svg" width="24" height="28" viewBox="0 0 24 28" fill="none">
4848
<path d="M20.9144 8.1816C20.7752 8.2896 18.3176 9.6744 18.3176 12.7536C18.3176 16.3152 21.4448 17.5752 21.5384 17.6064C21.524 17.6832 21.0416 19.332 19.8896 21.012C18.8624 22.4904 17.7896 23.9664 16.1576 23.9664C14.5256 23.9664 14.1056 23.0184 12.2216 23.0184C10.3856 23.0184 9.7328 23.9976 8.24 23.9976C6.7472 23.9976 5.7056 22.6296 4.508 20.9496C3.1208 18.9768 2 15.912 2 13.0032C2 8.3376 5.0336 5.8632 8.0192 5.8632C9.6056 5.8632 10.928 6.9048 11.924 6.9048C12.872 6.9048 14.3504 5.8008 16.1552 5.8008C16.8392 5.8008 19.2968 5.8632 20.9144 8.1816ZM15.2984 3.8256C16.0448 2.94 16.5728 1.7112 16.5728 0.4824C16.5728 0.312 16.5584 0.1392 16.5272 0C15.3128 0.0456 13.868 0.8088 12.9968 1.8192C12.3128 2.5968 11.6744 3.8256 11.6744 5.0712C11.6744 5.2584 11.7056 5.4456 11.72 5.5056C11.7968 5.52 11.9216 5.5368 12.0464 5.5368C13.136 5.5368 14.5064 4.8072 15.2984 3.8256Z" fill="currentColor"/>
4949
</svg>
50+
{% elif brand == "discord" %}
51+
<svg class="{{ class }}" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M19.27 5.33C17.94 4.71 16.5 4.26 15 4a.1.1 0 0 0-.07.03c-.18.33-.39.76-.53 1.09a16.1 16.1 0 0 0-4.8 0c-.14-.34-.35-.76-.54-1.09c-.01-.02-.04-.03-.07-.03c-1.5.26-2.93.71-4.27 1.33c-.01 0-.02.01-.03.02c-2.72 4.07-3.47 8.03-3.1 11.95c0 .02.01.04.03.05c1.8 1.32 3.53 2.12 5.24 2.65c.03.01.06 0 .07-.02c.4-.55.76-1.13 1.07-1.74c.02-.04 0-.08-.04-.09c-.57-.22-1.11-.48-1.64-.78c-.04-.02-.04-.08-.01-.11c.11-.08.22-.17.33-.25c.02-.02.05-.02.07-.01c3.44 1.57 7.15 1.57 10.55 0c.02-.01.05-.01.07.01c.11.09.22.17.33.26c.04.03.04.09-.01.11c-.52.31-1.07.56-1.64.78c-.04.01-.05.06-.04.09c.32.61.68 1.19 1.07 1.74c.03.01.06.02.09.01c1.72-.53 3.45-1.33 5.25-2.65c.02-.01.03-.03.03-.05c.44-4.53-.73-8.46-3.1-11.95c-.01-.01-.02-.02-.04-.02M8.52 14.91c-1.03 0-1.89-.95-1.89-2.12s.84-2.12 1.89-2.12c1.06 0 1.9.96 1.89 2.12c0 1.17-.84 2.12-1.89 2.12m6.97 0c-1.03 0-1.89-.95-1.89-2.12s.84-2.12 1.89-2.12c1.06 0 1.9.96 1.89 2.12c0 1.17-.83 2.12-1.89 2.12"/></svg>
5052
{% endif %}
5153
{% endmacro %}

0 commit comments

Comments
 (0)