Browse Source

fix: ignore discriminator if the value is "0"

pull/54/head
Hiroyuki Wada 2 months ago
parent
commit
4c68b69b0b
  1. 7
      src/main/java/org/keycloak/social/discord/DiscordIdentityProvider.java

7
src/main/java/org/keycloak/social/discord/DiscordIdentityProvider.java

@ -69,7 +69,12 @@ public class DiscordIdentityProvider extends AbstractOAuth2IdentityProvider<Disc
protected BrokeredIdentityContext extractIdentityFromProfile(EventBuilder event, JsonNode profile) {
BrokeredIdentityContext user = new BrokeredIdentityContext(getJsonProperty(profile, "id"), getConfig());
user.setUsername(getJsonProperty(profile, "username") + "#" + getJsonProperty(profile, "discriminator"));
String username = getJsonProperty(profile, "username");
String discriminator = getJsonProperty(profile, "discriminator");
if (!discriminator.equals("0")) {
username = username + "#" + discriminator;
}
user.setUsername(username);
user.setEmail(getJsonProperty(profile, "email"));
user.setIdp(this);

Loading…
Cancel
Save