Skip to content

Commit 43ba06d

Browse files
stapelbergthegcat
authored andcommitted
OIDCAuthBackend: query userinfo instead of using id_token fields
Authelia v4.39.0 has changed how it populates the id_token: https://www.authelia.com/blog/4.39-release-notes/ (“ID Token Changes”) Attributes like "name" or "email" are no longer present in id_token, and should be fetched via userinfo in any case, see also the pyoidc docs: https://pyoidc.readthedocs.io/en/latest/examples/rp.html This change fixes logging into pretix with Authelia ≥ v4.39.0.
1 parent e887a6d commit 43ba06d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Fixed
1111

1212
- Published on PyPi now
13+
- Query userinfo for user data (fixes login with Authelia ≥ v4.39.0)
1314

1415
## [2.2.1] - 2025-02-01
1516

pretix_oidc/auth.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,13 @@ def process_callback(self, request):
116116
authn_method="client_secret_basic",
117117
)
118118

119+
userinfo = self.client.do_user_info_request(state=auth_response["state"])
120+
119121
id_token = access_token_response["id_token"]
120122
user_data = {
121-
"uuid": id_token[config.get("oidc", "unique_attribute", fallback="sub")],
122-
"email": id_token["email"],
123-
"fullname": id_token["name"],
123+
"uuid": userinfo[config.get("oidc", "unique_attribute", fallback="sub")],
124+
"email": userinfo["email"],
125+
"fullname": userinfo["name"],
124126
"auth_backend": self.identifier,
125127
}
126128

0 commit comments

Comments
 (0)