Код: < /p>
Код: Выделить всё
// sending post to create endpoint to generate qr code and login code
app.post('/login/create', async (req, res) => {
console.log('Creating login session...');
try {
const response = await axios.post('https://apis.roblox.com/auth-token-service/v1/login/create', {}, {
headers: {
'accept': 'application/json, text/plain, */*',
'accept-language': 'en-US,en;q=0.9',
'cookie': req.headers.cookie,
'x-csrf-token': req.headers['x-csrf-token'],
}
});
const { code, imagePath, privateKey } = response.data;
const qrCodeUrl = `https://apis.roblox.com/auth-token-service${imagePath}`;
console.log('Login session created successfully:', { code, qrCodeUrl, privateKey });
res.json({ code, qrCodeUrl, privateKey });
} catch (error) {
console.error('Error creating login session:', error.message);
res.status(500).json({ error: error.message });
}
});
< /code>
//login status once I scan the qr code and approve the login
app.post('/login/status', async (req, res) => {
const { code, privateKey } = req.body;
console.log('Checking login status for code:', code);
try {
const response = await axios.post('https://apis.roblox.com/auth-token-service/v1/login/status', {
code,
privateKey
}, {
headers: {
'accept': 'application/json, text/plain, */*',
'accept-language': 'en-US,en;q=0.9',
'content-type': 'application/json;charset=UTF-8',
'x-csrf-token': req.headers['x-csrf-token'],
}
});
console.log('Login status response:', response.data);
res.json(response.data);
} catch (error) {
console.error('Error checking login status:', error.message);
res.status(500).json({ error: error.message });
}
});
< /code>
Но он все еще возвращает: < /p>
Checking login status for code: B8VHPW
Error checking login status: Request failed with status code 403
Подробнее здесь: https://stackoverflow.com/questions/793 ... gin-status