mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-22 11:42:14 -08:00
Fixed 'Failed to verify username.'
Send first request without clientToken, store the returned clientToken, use that for subsequent requests. Dont generate random UUID for clientToken, it can sometimes be 'bad'. Removed dependency 'uuid'. Updated 'electron-builder'.
This commit is contained in:
parent
eb946d6a2a
commit
a9f12ee329
@ -30,6 +30,9 @@ exports.addAccount = async function(username, password){
|
||||
try {
|
||||
const session = await Mojang.authenticate(username, password, ConfigManager.getClientToken())
|
||||
const ret = ConfigManager.addAuthAccount(session.selectedProfile.id, session.accessToken, username, session.selectedProfile.name)
|
||||
if(ConfigManager.getClientToken() == null){
|
||||
ConfigManager.setClientToken(session.clientToken)
|
||||
}
|
||||
ConfigManager.save()
|
||||
return ret
|
||||
} catch (err){
|
||||
|
@ -2,7 +2,6 @@ const fs = require('fs')
|
||||
const mkpath = require('mkdirp')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
const uuidV4 = require('uuid/v4')
|
||||
|
||||
const logger = require('./loggerutil')('%c[ConfigManager]', 'color: #a02d2a; font-weight: bold')
|
||||
|
||||
@ -68,7 +67,7 @@ const DEFAULT_CONFIG = {
|
||||
},
|
||||
commonDirectory: path.join(dataPath, 'common'),
|
||||
instanceDirectory: path.join(dataPath, 'instances'),
|
||||
clientToken: uuidV4(),
|
||||
clientToken: null,
|
||||
selectedServer: null, // Resolved
|
||||
selectedAccount: null,
|
||||
authenticationDatabase: {},
|
||||
|
@ -133,16 +133,21 @@ exports.status = function(){
|
||||
*/
|
||||
exports.authenticate = function(username, password, clientToken, requestUser = true, agent = minecraftAgent){
|
||||
return new Promise((resolve, reject) => {
|
||||
request.post(authpath + '/authenticate',
|
||||
{
|
||||
json: true,
|
||||
body: {
|
||||
|
||||
const body = {
|
||||
agent,
|
||||
username,
|
||||
password,
|
||||
clientToken,
|
||||
requestUser
|
||||
}
|
||||
if(clientToken != null){
|
||||
body.clientToken = clientToken
|
||||
}
|
||||
|
||||
request.post(authpath + '/authenticate',
|
||||
{
|
||||
json: true,
|
||||
body
|
||||
},
|
||||
function(error, response, body){
|
||||
if(error){
|
||||
|
124
package-lock.json
generated
124
package-lock.json
generated
@ -134,28 +134,28 @@
|
||||
}
|
||||
},
|
||||
"app-builder-bin": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-2.2.0.tgz",
|
||||
"integrity": "sha512-ckiG/zWjmCN6dtzOtx4g0Bno9qFlQFViwGoWKNNLUMRM33Fsq2fsSOMbK2JpqPJfAcPJOXPzoB2kcuUuIbIwwA==",
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-2.3.0.tgz",
|
||||
"integrity": "sha512-jxquarsPVHkUMatxFZzuEmovy2pxaGCIsVqZiAIdQV7wm1Cbq3Jl+gsq26aMXFFIgsN19jCq2HCoXhVv+Mx7HA==",
|
||||
"dev": true
|
||||
},
|
||||
"app-builder-lib": {
|
||||
"version": "20.31.1",
|
||||
"resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-20.31.1.tgz",
|
||||
"integrity": "sha512-YveVI7JYJPDreWRQkfRGdTBTxoFKhuslsoVcfNP1yQi+mx2UfRp4xFNOdTJdIoxbpYfmJ/llddD8fDNuTF4p/A==",
|
||||
"version": "20.31.2",
|
||||
"resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-20.31.2.tgz",
|
||||
"integrity": "sha512-f5khvF27oGIGL6C4zJzsjbpVulfBAVIkqrumEmm1ZJQGqPdBZeIQz9FgolQJO0BQh0JOtfClyHMtsPlOXBV6/Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"7zip-bin": "~4.1.0",
|
||||
"app-builder-bin": "2.2.0",
|
||||
"app-builder-bin": "2.3.0",
|
||||
"async-exit-hook": "^2.0.1",
|
||||
"bluebird-lst": "^1.0.6",
|
||||
"builder-util": "7.2.1",
|
||||
"builder-util": "8.0.0",
|
||||
"builder-util-runtime": "6.1.0",
|
||||
"chromium-pickle-js": "^0.2.0",
|
||||
"debug": "^4.1.0",
|
||||
"ejs": "^2.6.1",
|
||||
"electron-osx-sign": "0.4.11",
|
||||
"electron-publish": "20.31.1",
|
||||
"electron-publish": "20.31.2",
|
||||
"fs-extra-p": "^7.0.0",
|
||||
"hosted-git-info": "^2.7.1",
|
||||
"is-ci": "^1.2.1",
|
||||
@ -165,7 +165,7 @@
|
||||
"minimatch": "^3.0.4",
|
||||
"normalize-package-data": "^2.4.0",
|
||||
"plist": "^3.0.1",
|
||||
"read-config-file": "3.1.2",
|
||||
"read-config-file": "3.1.3",
|
||||
"sanitize-filename": "^1.6.1",
|
||||
"semver": "^5.6.0",
|
||||
"temp-file": "^3.1.3"
|
||||
@ -465,13 +465,13 @@
|
||||
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A=="
|
||||
},
|
||||
"builder-util": {
|
||||
"version": "7.2.1",
|
||||
"resolved": "https://registry.npmjs.org/builder-util/-/builder-util-7.2.1.tgz",
|
||||
"integrity": "sha512-40RhIM7dzvLht1jrUXhLYYXZZb5zCLKoG5pbdrNdsKncoBSQfOZ8dfCPVG0vgi1Ngh8kisbSVmHxss3nylJ1WQ==",
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/builder-util/-/builder-util-8.0.0.tgz",
|
||||
"integrity": "sha512-hszhXrRZKfBf+178Y+QZCLwSH5UXgnDX+/q+fIRtFktCk5Dc9ipdvHAKPVfzhc5vhiw/eVDdFUUX8ShAQcyyBA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"7zip-bin": "~4.1.0",
|
||||
"app-builder-bin": "2.2.0",
|
||||
"app-builder-bin": "2.3.0",
|
||||
"bluebird-lst": "^1.0.6",
|
||||
"builder-util-runtime": "^6.1.0",
|
||||
"chalk": "^2.4.1",
|
||||
@ -925,14 +925,14 @@
|
||||
}
|
||||
},
|
||||
"dmg-builder": {
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-6.1.1.tgz",
|
||||
"integrity": "sha512-aMB7o/z0MmzwBHZzJDefmcH7bR98DinRyjT3TRs3Z2UKsjMiagQ4F9jGq50uqs4CnaHJ7aOfq3PcwBppdFMRiw==",
|
||||
"version": "6.1.2",
|
||||
"resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-6.1.2.tgz",
|
||||
"integrity": "sha512-zhU2toylQ4A82mtubyDBmP0KJnF+b7uXVX+xIJwDR5fsPzIJIT9Uy0x2cwmhMby+4KrPBqg3bMHrbGgIPX7MNw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"app-builder-lib": "~20.31.1",
|
||||
"app-builder-lib": "~20.31.2",
|
||||
"bluebird-lst": "^1.0.6",
|
||||
"builder-util": "~7.2.1",
|
||||
"builder-util": "~8.0.0",
|
||||
"fs-extra-p": "^7.0.0",
|
||||
"iconv-lite": "^0.4.24",
|
||||
"js-yaml": "^3.12.0",
|
||||
@ -1044,21 +1044,21 @@
|
||||
}
|
||||
},
|
||||
"electron-builder": {
|
||||
"version": "20.31.1",
|
||||
"resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-20.31.1.tgz",
|
||||
"integrity": "sha512-a/V2QAVt0ZXFD/Lyqe0s1mqQ9funqznAYc9ygMjal+oUG6rXkhJRYVvvL+IT96coQeJKPtpc80F+SDi/PHFqlQ==",
|
||||
"version": "20.31.2",
|
||||
"resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-20.31.2.tgz",
|
||||
"integrity": "sha512-X1Jie7261BFHuWpn4F2dtNlfWkaNkLXAsLgrYr5hWleWr0OYNEXuWowPkeLEFARKga4met41VkjYLurCtHpeXg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"app-builder-lib": "20.31.1",
|
||||
"app-builder-lib": "20.31.2",
|
||||
"bluebird-lst": "^1.0.6",
|
||||
"builder-util": "7.2.1",
|
||||
"builder-util": "8.0.0",
|
||||
"builder-util-runtime": "6.1.0",
|
||||
"chalk": "^2.4.1",
|
||||
"dmg-builder": "6.1.1",
|
||||
"dmg-builder": "6.1.2",
|
||||
"fs-extra-p": "^7.0.0",
|
||||
"is-ci": "^1.2.1",
|
||||
"lazy-val": "^1.0.3",
|
||||
"read-config-file": "3.1.2",
|
||||
"read-config-file": "3.1.3",
|
||||
"sanitize-filename": "^1.6.1",
|
||||
"update-notifier": "^2.5.0",
|
||||
"yargs": "^12.0.2"
|
||||
@ -1171,13 +1171,13 @@
|
||||
}
|
||||
},
|
||||
"electron-publish": {
|
||||
"version": "20.31.1",
|
||||
"resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-20.31.1.tgz",
|
||||
"integrity": "sha512-R4p+BxuuDr40a7GyuW0xnRkFwmVuA4QkmwLAPl53+57utA9bw+NZ8ssKtbBFhVAXDI1s3aapT5vsok3F6VOPrw==",
|
||||
"version": "20.31.2",
|
||||
"resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-20.31.2.tgz",
|
||||
"integrity": "sha512-5R8Nxnc/26BJbvFn2h3oD8aoMMxjE5CnPWm5j92Cuze+Ht7x6AoSDQAa1Cx6L19X/HSE3DWjTXEOe08SP3N/QA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bluebird-lst": "^1.0.6",
|
||||
"builder-util": "~7.2.1",
|
||||
"builder-util": "~8.0.0",
|
||||
"builder-util-runtime": "^6.1.0",
|
||||
"chalk": "^2.4.1",
|
||||
"fs-extra-p": "^7.0.0",
|
||||
@ -1685,7 +1685,7 @@
|
||||
},
|
||||
"get-stream": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
|
||||
"integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=",
|
||||
"dev": true
|
||||
},
|
||||
@ -1746,7 +1746,7 @@
|
||||
},
|
||||
"got": {
|
||||
"version": "6.7.1",
|
||||
"resolved": "http://registry.npmjs.org/got/-/got-6.7.1.tgz",
|
||||
"resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz",
|
||||
"integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
@ -1980,7 +1980,7 @@
|
||||
},
|
||||
"is-obj": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
|
||||
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
|
||||
"integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=",
|
||||
"dev": true
|
||||
},
|
||||
@ -2123,9 +2123,9 @@
|
||||
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
|
||||
},
|
||||
"json5": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "http://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
|
||||
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz",
|
||||
"integrity": "sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"minimist": "^1.2.0"
|
||||
@ -2553,7 +2553,7 @@
|
||||
},
|
||||
"p-is-promise": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "http://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz",
|
||||
"integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=",
|
||||
"dev": true
|
||||
},
|
||||
@ -2788,19 +2788,19 @@
|
||||
}
|
||||
},
|
||||
"read-config-file": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/read-config-file/-/read-config-file-3.1.2.tgz",
|
||||
"integrity": "sha512-QCATYzlYHvmWps/W/eP7rcKuhYRYZg5XKeXFxSJRIXvn+KSw1+Ntz2et1aBz5TrEpawGrxWZ7zBipj+/v0xwWQ==",
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/read-config-file/-/read-config-file-3.1.3.tgz",
|
||||
"integrity": "sha512-KVrZEmKOntnHqQFk69rw45A4oQ2npIMdKga4CcD8Yr38FQeYlE4S1JLFY9cll+vf0kVtSXDPperuQWEQto1jgQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ajv": "^6.5.2",
|
||||
"ajv": "^6.5.4",
|
||||
"ajv-keywords": "^3.2.0",
|
||||
"bluebird-lst": "^1.0.5",
|
||||
"dotenv": "^6.0.0",
|
||||
"bluebird-lst": "^1.0.6",
|
||||
"dotenv": "^6.1.0",
|
||||
"dotenv-expand": "^4.2.0",
|
||||
"fs-extra-p": "^4.6.1",
|
||||
"fs-extra-p": "^7.0.0",
|
||||
"js-yaml": "^3.12.0",
|
||||
"json5": "^1.0.1",
|
||||
"json5": "^2.1.0",
|
||||
"lazy-val": "^1.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -2816,12 +2816,42 @@
|
||||
"uri-js": "^4.2.2"
|
||||
}
|
||||
},
|
||||
"bluebird-lst": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/bluebird-lst/-/bluebird-lst-1.0.6.tgz",
|
||||
"integrity": "sha512-CBWFoPuUPpcvMUxfyr8DKdI5d4kjxFl1h39+VbKxP3KJWJHEsLtuT4pPLkjpxCGU6Ask21tvbnftWXdqIxYldQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bluebird": "^3.5.2"
|
||||
}
|
||||
},
|
||||
"fast-deep-equal": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
|
||||
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=",
|
||||
"dev": true
|
||||
},
|
||||
"fs-extra": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.0.tgz",
|
||||
"integrity": "sha512-EglNDLRpmaTWiD/qraZn6HREAEAHJcJOmxNEYwq6xeMKnVMAy3GUcFB+wXt2C6k4CNvB/mP1y/U3dzvKKj5OtQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.2",
|
||||
"jsonfile": "^4.0.0",
|
||||
"universalify": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"fs-extra-p": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra-p/-/fs-extra-p-7.0.0.tgz",
|
||||
"integrity": "sha512-5tg5jBOd0xIXjwj4PDnafOXL5TyPVzjxLby4DPKev53wurEXp7IsojBaD4Lj5M5w7jxw0pbkEU0fFEPmcKoMnA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"bluebird-lst": "^1.0.6",
|
||||
"fs-extra": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"json-schema-traverse": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
||||
@ -3212,7 +3242,7 @@
|
||||
},
|
||||
"strip-eof": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
|
||||
"integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=",
|
||||
"dev": true
|
||||
},
|
||||
@ -3692,7 +3722,7 @@
|
||||
},
|
||||
"wrap-ansi": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
|
||||
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
|
@ -44,12 +44,11 @@
|
||||
"rimraf": "^2.6.2",
|
||||
"semver": "^5.6.0",
|
||||
"tar-fs": "^1.16.3",
|
||||
"uuid": "^3.3.2",
|
||||
"winreg": "^1.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^3.0.7",
|
||||
"electron-builder": "^20.31.1",
|
||||
"electron-builder": "^20.31.2",
|
||||
"eslint": "^5.8.0"
|
||||
},
|
||||
"build": {
|
||||
|
Loading…
Reference in New Issue
Block a user