diff --git a/auth_partner/models/auth_directory.py b/auth_partner/models/auth_directory.py index afe997ad..5a862ca0 100644 --- a/auth_partner/models/auth_directory.py +++ b/auth_partner/models/auth_directory.py @@ -147,6 +147,8 @@ def _send_mail_impl(self, type_or_template, auth_partner, **context): return f"Mail {template.name} sent to {auth_partner.login}" def _generate_token(self, action, auth_partner, expiration_delta, key_salt=""): + # We need to sudo here as secret_key is a protected field + self = self.sudo() return jwt.encode( { "exp": datetime.now(tz=timezone.utc) + expiration_delta,