How is Discord Tokens, User IDs, Channel IDs etc created?

0

Issue

I’m wanting to replicate the ID system that Discord uses, for such as UserID/ChannelID/etc
and how a Discord Account Token (not 2fa) is generated.

I’m currently working a social platform system, and would love to use some of Discord’s features for ideas in my project.

I don’t have a clue as to where to start with either of these, is there any documention or examples of where I can see how it’s done, I understand Discord is OpenSource but it’s not fully OpenSource in the sense of the backend stuff.

Solution

Here’s a small explanation of all the things you’ve asked.

IDs

As described on the API documentation Discord is using Twitter’s snowflake format to generate ID. With that you can get the timestamp of generation and therefore you know when a channel, user or server has been created.

Feel free to read the documentation 😀

Tokens

Tokens don’t match JSON Web Tokens and there’s not a lot of information about these so I’d guess they’re simply randomized to something like {x characters}.{y characters}.{z characters}.

Storing

Like most of the softwares they use a database to store their information. They used MongoDB and have now moved to Cassandra, see this blog post.

Answered By – Krypton

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More