noblox.js
Advanced tools
Comparing version 4.7.1 to 4.7.2
// Includes | ||
const options = require('../options.js') | ||
const getGeneralToken = require('./getGeneralToken.js').func | ||
const getVerification = require('./getVerification.js').func | ||
const http = require('./http.js').func | ||
@@ -16,34 +15,27 @@ // Args | ||
} | ||
return getVerification({ url: 'https://www.roblox.com/my/account#!/security' }) | ||
.then((ver) => { | ||
if (!ver.header) throw new Error('Failed to refresh - Invalid or expired cookie.') | ||
return getGeneralToken({}).then((token) => { | ||
return http({ | ||
url: 'https://www.roblox.com/authentication/signoutfromallsessionsandreauthenticate', | ||
options: { | ||
method: 'POST', | ||
resolveWithFullResponse: true, | ||
verification: ver.header, | ||
jar: null, | ||
headers: { | ||
'X-CSRF-TOKEN': token | ||
}, | ||
form: { | ||
__RequestVerificationToken: ver.inputs.__RequestVerificationToken | ||
} | ||
} | ||
}).then((res) => { | ||
const cookies = res.headers['set-cookie'] | ||
if (cookies) { | ||
const cookie = cookies.toString().match(/\.ROBLOSECURITY=(.*?);/)[1] | ||
options.jar.session = cookie | ||
return cookie | ||
} else { | ||
throw new Error('Failed to refresh cookie: None returned.') | ||
} | ||
}) | ||
}) | ||
return getGeneralToken({}).then((token) => { | ||
return http({ | ||
url: 'https://www.roblox.com/authentication/signoutfromallsessionsandreauthenticate', | ||
options: { | ||
method: 'POST', | ||
resolveWithFullResponse: true, | ||
jar: null, | ||
headers: { | ||
'X-CSRF-TOKEN': token | ||
} | ||
} | ||
}).then((res) => { | ||
const cookies = res.headers['set-cookie'] | ||
if (cookies) { | ||
const cookie = cookies.toString().match(/\.ROBLOSECURITY=(.*?);/)[1] | ||
options.jar.session = cookie | ||
return cookie | ||
} else { | ||
throw new Error('Failed to refresh cookie: None returned.') | ||
} | ||
}) | ||
}) | ||
} | ||
module.exports = refreshCookie |
{ | ||
"name": "noblox.js", | ||
"version": "4.7.1", | ||
"version": "4.7.2", | ||
"description": "A Node.js wrapper for ROBLOX. (original from sentanos)", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
270887
6971