0

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',
    });
})();

zero_one
  • 1
  • 1
  • What does the actual request give you in the network inspector? I’d say possibly a CORS error…? – deceze Mar 06 '23 at 05:55
  • status 0 almost always means a CORS error - and no, you can't "hack" websites like that from the browser – Jaromanda X Mar 06 '23 at 05:59
  • In network inspector I was getting warning that provisional hidders are shown so I disable catche as per suggested but still no help @deceze – zero_one Mar 07 '23 at 13:11
  • The console probably says something about a CORS error…?! – deceze Mar 07 '23 at 13:12

0 Answers0