From eb60bba0d59a2e207d1192167bdcbca00dc7e442 Mon Sep 17 00:00:00 2001 From: Ellis Percival Date: Mon, 30 Jan 2023 15:38:10 +0000 Subject: [PATCH] providers/oauth2: cast user.pk to string when using it for token 'sub' value (#4570) --- authentik/providers/oauth2/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/authentik/providers/oauth2/models.py b/authentik/providers/oauth2/models.py index baf2f45f4..a85b1869a 100644 --- a/authentik/providers/oauth2/models.py +++ b/authentik/providers/oauth2/models.py @@ -487,7 +487,7 @@ class RefreshToken(SerializerModel, ExpiringModel, BaseGrantModel): if self.provider.sub_mode == SubModes.HASHED_USER_ID: sub = user.uid elif self.provider.sub_mode == SubModes.USER_ID: - sub = user.pk + sub = str(user.pk) elif self.provider.sub_mode == SubModes.USER_EMAIL: sub = user.email elif self.provider.sub_mode == SubModes.USER_USERNAME: