diff --git a/services/src/main/java/org/keycloak/social/google/GoogleIdentityProvider.java b/services/src/main/java/org/keycloak/social/google/GoogleIdentityProvider.java index afd04301f6..10b29db116 100755 --- a/services/src/main/java/org/keycloak/social/google/GoogleIdentityProvider.java +++ b/services/src/main/java/org/keycloak/social/google/GoogleIdentityProvider.java @@ -88,6 +88,12 @@ public class GoogleIdentityProvider extends OIDCIdentityProvider implements Soci identity.getContextData().put(VALIDATED_ID_TOKEN, idToken); + if (!getConfig().isDisableUserInfoService() && accessToken != null && name == null) { + JsonNode userInfo = SimpleHttp.doGet(getUserInfoUrl(), session) + .header("Authorization", "Bearer " + accessToken).asJson(); + name = getJsonProperty(userInfo, "name"); + } + identity.setId(id); identity.setName(name); identity.setEmail(email);