diff --git a/pandora/app/oidc.py b/pandora/app/oidc.py index 31a5adcd..be397374 100644 --- a/pandora/app/oidc.py +++ b/pandora/app/oidc.py @@ -12,7 +12,11 @@ User = get_user_model() class OIDCAuthenticationBackend(mozilla_django_oidc.auth.OIDCAuthenticationBackend): def create_user(self, claims): user = super(OIDCAuthenticationBackend, self).create_user(claims) - username = claims.get("preferred_username") + username = None + for key in ('preferred_username', 'name'): + if claims.get(key): + username = claims[key] + break n = 1 if username and username != user.username: uname = username