diff --git a/src/main/java/org/keycloak/social/discord/DiscordIdentityProvider.java b/src/main/java/org/keycloak/social/discord/DiscordIdentityProvider.java index 4659183..b14fc3e 100755 --- a/src/main/java/org/keycloak/social/discord/DiscordIdentityProvider.java +++ b/src/main/java/org/keycloak/social/discord/DiscordIdentityProvider.java @@ -71,9 +71,11 @@ protected BrokeredIdentityContext extractIdentityFromProfile(EventBuilder event, String username = getJsonProperty(profile, "username"); String discriminator = getJsonProperty(profile, "discriminator"); - if (!discriminator.equals("0")) { - username = username + "#" + discriminator; + + if (!"0".equals(discriminator)) { + username += "#" + discriminator; } + user.setUsername(username); user.setEmail(getJsonProperty(profile, "email")); user.setIdp(this);