Discord Discriminator

Hello,

I have two different tenant with Discord activate,

The both have the same discord & auth0 configuration, but …

In the first, i have more informations from discord (Discriminator, etc …)

{
    "avatar": "0123012301230123001230123",
    "created_at": "2020-12-26T23:55:33.430Z",
    "discriminator": "4855",
    "flags": 0,
    "identities": [
        {
            "provider": "oauth2",
            "user_id": "discord|012301230123",
            "connection": "discord",
            "isSocial": true
        }
    ],
    "locale": "fr",
    "mfa_enabled": true,
    "name": "",
    "nickname": "",
    "picture": "https://cdn.auth0.com/avatars/default.png",
    "public_flags": 0,
    "updated_at": "2021-04-06T21:35:19.968Z",
    "user_id": "oauth2|discord|012301230123",
    "username": "Username",
    "last_ip": "000.000.000.00",
    "last_login": "2021-04-06T21:35:19.966Z",
    "logins_count": 44,
    "blocked_for": ,
    "guardian_authenticators": 
} 

In the second, i have less information, but i lost very important for discord … discriminator

{
    "created_at": "2021-04-06T21:55:18.106Z",
    "identities": [
        {
            "provider": "oauth2",
            "user_id": "discord|01230123",
            "connection": "discord",
            "isSocial": true
        }
    ],
    "name": "Username",
    "nickname": "Username",
    "picture": "https://cdn.discordapp.com/avatars/01230123/01230123.png",
    "updated_at": "2021-04-06T21:55:18.106Z",
    "user_id": "oauth2|discord|01230123",
    "last_ip": "000.000.000.00",
    "last_login": "2021-04-06T21:55:18.105Z",
    "logins_count": 1,
    "blocked_for": ,
    "guardian_authenticators": 
}

Anyone have an idea ? Losing discriminator in discord, it’s very bad … :confused:
Kind regards,

Not sure if I understand the context correctly. Can you provide us with more explanation so that someone from community will be able to help? Thank you!

Hello, i can try.

I have two application discord and two tenant in auth0.

In the first application, when i view Raw from user information, i have discord Discriminator.
In the second application with same configuration in both part, when i view Raw from user information, the Discriminator is missing.

Please format the original post with proper code formatting (as json), it will make it easier to read and it’ll indent it properly.

I have two application discord and two tenant in auth0.

Are both application making the same kind of authorize request to Auth0, with the same scopes?

when i view Raw from user information

Where are you viewing this? In the application itself, or in the Auth0 dashboard > User > Raw Json?

Hello,

Are both application making the same kind of authorize request to Auth0, with the same scopes?

Yes, same scope.

Where are you viewing this? In the application itself, or in the Auth0 dashboard > User > Raw Json?

The data comes from Auth0 Dashboard.

Up, no idea about my issue ?

We don’t have any official guide on that but maybe if you wait a bit more someone from the community faced similar issue and will be able to help

Hi @Hantse,

I’m just playing around with Auth0 in my development environment but I came across this issue as well.

I’m not sure why the official Discord Social does not save the discriminator anymore but I found a workaround: create a custom social.

And this is the fetch user profile script. Definitely contains things that do not work. Use at your own risk. (if I happen to improve the script, i’ll update this post)

function fetchUserProfile(accessToken, context, callback) {
  request.get(
    {
      url: 'https://discord.com/api/users/@me',
      headers: {
        'Authorization': 'Bearer ' + accessToken,
      }
    },
    (err, resp, body) => {
      if (err) {
        return callback(err);
      }

      if (resp.statusCode !== 200) {
        return callback(new Error(body));
      }

      let bodyParsed;
      try {
        bodyParsed = JSON.parse(body);
      } catch (jsonError) {
        return callback(new Error(body));
      }

      const profile = {
        user_id: bodyParsed.id,
        email: bodyParsed.email,
        picture: `https://cdn.discordapp.com/avatars/${bodyParsed.id}/${bodyParsed.avatar}.jpg`,
        discriminator: bodyParsed.discriminator,
        username: bodyParsed.username
      };

      callback(null, profile);
    }
  );
}
2 Likes

Thanks for sharing that @beltekylevi with the rest of community!