Follow the authentication spec more closely : use username sent by mojang. (#684)

* Follow the authentication spec more closely.

Theoretically this shouldn't make much of a difference, but I did notice it when I was reading through the npm code.
We should trust the API, not our own understanding of the API, just for safety reasons.

* Keep comment together with relevant code.
This commit is contained in:
Kneesnap 2020-03-28 09:32:53 -07:00 committed by GitHub
parent b6d47ddc8e
commit 5ccb48e255
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,6 +83,7 @@ module.exports = function (client, server, options) {
// Convert to a valid UUID until the session server updates and does
// it automatically
client.uuid = profile.id.replace(/(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})/, '$1-$2-$3-$4-$5')
client.username = profile.name
client.profile = profile
loginClient()
})