I am trying to access the api but for accessing the api I need token so When I try to hit the api it redirects to the auth page.
I can see the redirection is happening in the network tab.
is there any way to prevent this?
I wanted to get the 302 error code when I first hit the api(its giving 302 but with fetch/Redirect) but because of automatic redirection its throwing error and going to error block always.
fetch(url, { method: 'POST', redirect: 'follow'})
.then(response => {
// handle 302 response
})
.catch(function(err) {
console.info(err);
});