Changes to Auth, proper credits

This commit is contained in:
Pierce 2019-08-12 12:34:28 -04:00
parent 388feda287
commit 407d7faef2
3 changed files with 14 additions and 4 deletions

View file

@ -122,6 +122,7 @@ You'll need to provide the folder created in the versions if you're running the
| Parameter | Type | Description | Required | | Parameter | Type | Description | Required |
|--------------|--------|-------------------------------------------------------------------|----------| |--------------|--------|-------------------------------------------------------------------|----------|
| `access_token` | String | Token being checked if it can be used to login with (online mode). | True | | `access_token` | String | Token being checked if it can be used to login with (online mode). | True |
| `client_token` | String | Client token being checked to see if there was a change of client (online mode). | True |
##### refreshAuth ##### refreshAuth
@ -161,3 +162,10 @@ You'll need to provide the folder created in the versions if you're running the
#### What should it look like running from console? #### What should it look like running from console?
Showing the emitted information from debug and data, also using `getPid` after the process has been created. Showing the emitted information from debug and data, also using `getPid` after the process has been created.
![gif](https://pierce.is-serious.business/3N3PMC4.gif) ![gif](https://pierce.is-serious.business/3N3PMC4.gif)
## Contributors
These are the people that helped out that aren't listed [here](https://github.com/Pierce01/MinecraftLauncher-core/graphs/contributors)!
* [Pyker](https://github.com/Pyker) - Forge dependency parsing.
* [Khionu](https://github.com/khionu) - Research on how Minecraft's`natives` are handled.
* [Coding-Kiwi](https://github.com/Coding-Kiwi) - Pointed out I didn't pass `clientToken` in initial authentication function.
* maxbsoft - Pointed out that a certain JVM option causes OSX Minecraft to bug out.

View file

@ -26,6 +26,7 @@ module.exports.getAuth = function (username, password) {
}, },
username: username, username: username,
password: password, password: password,
clientToken: uuid(),
requestUser: true requestUser: true
} }
}; };
@ -38,7 +39,7 @@ module.exports.getAuth = function (username, password) {
const userProfile = { const userProfile = {
access_token: body.accessToken, access_token: body.accessToken,
client_token: uuid(), client_token: body.clientToken,
uuid: body.selectedProfile.id, uuid: body.selectedProfile.id,
name: body.selectedProfile.name, name: body.selectedProfile.name,
selected_profile: body.selectedProfile, selected_profile: body.selectedProfile,
@ -50,12 +51,13 @@ module.exports.getAuth = function (username, password) {
}); });
}; };
module.exports.validate = function (access_token) { module.exports.validate = function (access_token, client_token) {
return new Promise(resolve => { return new Promise(resolve => {
const requestObject = { const requestObject = {
url: api_url + "/validate", url: api_url + "/validate",
json: { json: {
"accessToken": access_token "accessToken": access_token,
"clientToken": client_token
} }
}; };

View file

@ -1,6 +1,6 @@
{ {
"name": "minecraft-launcher-core", "name": "minecraft-launcher-core",
"version": "3.7.5", "version": "3.7.6",
"description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS", "description": "Lightweight module that downloads and runs Minecraft using javascript / NodeJS",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {