令牌的网站进行身份验证"/>
如何使用 Axios 对使用 csrf 令牌的网站进行身份验证
我要验证到该网站的网站 =%2fHomeAccess 并且它使用“__RequestVerificationToken”,当您进入该网站和令牌隐藏在html中。我登录时检查了有效负载并发送了:
const axios = require('axios');
const cheerio = require('cheerio');
axios.get('')
.then((response) => {
const $ = cheerio.load(response.data);
const token = $('input[name="__RequestVerificationToken"]').val();
const payload = {
__RequestVerificationToken: token,
SCKTY00328510CustomEnabled: 'True',
SCKTY00436568CustomEnabled: 'True',
Database: '10',
VerificationOption: 'UsernamePassword',
'LogOnDetails.UserName': 'TestName',
tempUN: '',
tempPW: '',
'LogOnDetails.Password': 'TestPass'
};
return axios.post('', payload);
})
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.error(error);
});
当我尝试这个时,我得到的只是错误,我不确定为什么。
回答如下:更多推荐
如何使用 Axios 对使用 csrf 令牌的网站进行身份验证
发布评论