我如何向 Roblox 发出 post 请求?
How can I make a post request to Roblox?
我正在使用 Axios post 向 Roblox API 端点发送请求(https://friends.roblox.com/v1/users/1/follow) but it did not work, it keeps returning a 401 status code. Picture here
这是我的代码:
axios.post('https://friends.roblox.com/v1/users/1/follow', {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Cookie': cookie,
},
})
.then(data => console.log(data))
.catch(err => console.log(err));
我找到了答案。我需要先获取 X-CSRF-TOKEN。如果您需要帮助,这是获取 X-CSRF-TOKEN 的代码!
fetch('https://auth.roblox.com/v2/logout', {
method: 'POST',
headers: {
'X-CSRF-TOKEN': '',
'Cookie': cookie,
},
})
.then(data => {
let csrfToken = data.headers.get('x-csrf-token');
console.log(csrfToken);
})
.catch(err => console.log(err));
我正在使用 Axios post 向 Roblox API 端点发送请求(https://friends.roblox.com/v1/users/1/follow) but it did not work, it keeps returning a 401 status code. Picture here
这是我的代码:
axios.post('https://friends.roblox.com/v1/users/1/follow', {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Cookie': cookie,
},
})
.then(data => console.log(data))
.catch(err => console.log(err));
我找到了答案。我需要先获取 X-CSRF-TOKEN。如果您需要帮助,这是获取 X-CSRF-TOKEN 的代码!
fetch('https://auth.roblox.com/v2/logout', {
method: 'POST',
headers: {
'X-CSRF-TOKEN': '',
'Cookie': cookie,
},
})
.then(data => {
let csrfToken = data.headers.get('x-csrf-token');
console.log(csrfToken);
})
.catch(err => console.log(err));