diff --git a/src/authentic2_auth_oidc/backends.py b/src/authentic2_auth_oidc/backends.py index ed8ac7fa3..bc708fb85 100644 --- a/src/authentic2_auth_oidc/backends.py +++ b/src/authentic2_auth_oidc/backends.py @@ -45,6 +45,9 @@ class OIDCBackend(ModelBackend): logger.warning('auth_oidc: invalid id_token %s: %s', original_id_token, e) return None + id_token_content = id_token.as_dict(provider) + logger.debug('auth_oidc: id_token content %s', id_token_content) + try: provider = utils.get_provider_by_issuer(id_token.iss) except models.OIDCProvider.DoesNotExist: @@ -214,7 +217,7 @@ class OIDCBackend(ModelBackend): user_ou = provider.ou save_user = False mappings = [] - context = id_token.as_dict(provider) + context = id_token_content.copy() if need_user_info: context.update(user_info or {})