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:
@@ -133,16 +133,21 @@ exports.status = function(){
|
||||
*/
|
||||
exports.authenticate = function(username, password, clientToken, requestUser = true, agent = minecraftAgent){
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
const body = {
|
||||
agent,
|
||||
username,
|
||||
password,
|
||||
requestUser
|
||||
}
|
||||
if(clientToken != null){
|
||||
body.clientToken = clientToken
|
||||
}
|
||||
|
||||
request.post(authpath + '/authenticate',
|
||||
{
|
||||
json: true,
|
||||
body: {
|
||||
agent,
|
||||
username,
|
||||
password,
|
||||
clientToken,
|
||||
requestUser
|
||||
}
|
||||
body
|
||||
},
|
||||
function(error, response, body){
|
||||
if(error){
|
||||
|
||||
Reference in New Issue
Block a user