The website that I want to authenticate into this website https://homeaccess.katyisd.org/HomeAccess/Account/LogOn?ReturnUrl=%2fHomeAccess and it uses a “__RequestVerificationToken” that always changes when you enter the website and the token is hidden in the html. I checked the payload when I logged in and it sent: Payload When I logged into the website
const axios = require('axios');
const cheerio = require('cheerio');
axios.get('https://homeaccess.katyisd.org/HomeAccess/Account/LogOn')
.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('https://homeaccess.katyisd.org/HomeAccess/Account/LogOn', payload);
})
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.error(error);
});
When I tried this, all I got were errors and I am not sure why.