I need to redirect to another website and send the JWT as a bearer token as well.
Can I use fetch to do it?
Something like this:
$( document ).ready( function() {
document.getElementById('Aother-Website-Link').addEventListener('click', event => {
event.preventDefault();
fetch('Aother-Website-Link',
{
mode: "cors",
method: "GET",
headers: {
'Authorization': `Bearer ${jwt}`
}
})
.then(() => {
window.location.href = 'Aother-Website-Link';
})
.catch(error => {
console.error(error);
});
});
Via Active questions tagged javascript - Stack Overflow https://ift.tt/1xz7Tfd
Comments
Post a Comment