The token structure you provided is somewhat invalid. Yes, the first part of the token is the user ID base64 encoded, but after the second dot, it's a timestamp. So, a Discord token has three parts. If you decode the first part of the token, which is base64, to a string, it returns the user ID. You already know this since that is what the script is doing in just reverse order. Anyway, onto the next part. The second part of the token, if you decode it base64 as well, you get a timestamp. Then you use the epoch for tokens, which is 1293840000, and with that result, you decode the Unix timestamp, and then you can get the timestamp at which it was created.
The token structure you provided is somewhat invalid. Yes, the first part of the token is the user ID base64 encoded, but after the second dot, it's a timestamp. So, a Discord token has three parts. If you decode the first part of the token, which is base64, to a string, it returns the user ID. You already know this since that is what the script is doing in just reverse order. Anyway, onto the next part. The second part of the token, if you decode it base64 as well, you get a timestamp. Then you use the epoch for tokens, which is
1293840000
, and with that result, you decode the Unix timestamp, and then you can get the timestamp at which it was created.