I am getting the status code 303 in the node environment but with the same code I am getting the status code 0 in the browser environment. Most of the solutions on the web suggesting credentials:include but that also not working
(async () => {
const loginPageResponse = await fetch('https://www.linkedin.com/login');
const loginPageHtml = await loginPageResponse.text();
const loginCsrfParamMatches = loginPageHtml.match(/name="loginCsrfParam" value="([^"]+)"/);
const loginCsrfParam = loginCsrfParamMatches && loginCsrfParamMatches[1];
const loginFormData = new URLSearchParams();
loginFormData.append('session_key', 'user@gmail.com');
loginFormData.append('session_password', 'password');
loginFormData.append('loginCsrfParam', loginCsrfParam);
const loginResponse = await fetch('https://www.linkedin.com/uas/login-submit', {
method: 'POST',
body: loginFormData,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': '*/*',
'Referer': 'https://www.linkedin.com/login',
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
},
redirect: 'manual',
credentials:'include',
});
})();