-
Notifications
You must be signed in to change notification settings - Fork 35
/
refresh.js
62 lines (54 loc) · 1.99 KB
/
refresh.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const axios = require('axios');
async function fetchSessionCSRFToken(roblosecurityCookie) {
try {
await axios.post("https://auth.roblox.com/v2/logout", {}, {
headers: {
'Cookie': `.ROBLOSECURITY=${roblosecurityCookie}`
}
});
return null;
} catch (error) {
return error.response?.headers["x-csrf-token"] || null;
}
}
async function generateAuthTicket(roblosecurityCookie) {
try {
const csrfToken = await fetchSessionCSRFToken(roblosecurityCookie);
const response = await axios.post("https://auth.roblox.com/v1/authentication-ticket", {}, {
headers: {
"x-csrf-token": csrfToken,
"referer": "https://www.roblox.com/madebySynaptrixBitch",
'Content-Type': 'application/json',
'Cookie': `.ROBLOSECURITY=${roblosecurityCookie}`
}
});
return response.headers['rbx-authentication-ticket'] || "Failed to fetch auth ticket";
} catch (error) {
return "Failed to fetch auth ticket";
}
}
async function redeemAuthTicket(authTicket) {
try {
const response = await axios.post("https://auth.roblox.com/v1/authentication-ticket/redeem", {
"authenticationTicket": authTicket
}, {
headers: {
'RBXAuthenticationNegotiation': '1'
}
});
const refreshedCookieData = response.headers['set-cookie']?.toString() || "";
return {
success: true,
refreshedCookie: refreshedCookieData.match(/(_\|WARNING:-DO-NOT-SHARE-THIS.--Sharing-this-will-allow-someone-to-log-in-as-you-and-to-steal-your-ROBUX-and-items.\|_[A-Za-z0-9]+)/g)?.toString()
};
} catch (error) {
return {
success: false,
robloxDebugResponse: error.response?.data
};
}
}
module.exports = {
generateAuthTicket,
redeemAuthTicket
};