angular - Typescript can't get cookie from Response object -


in google chrome extension made post call looks this:

public someapicall(username: string, password: string) {     var url = 'http://test.sometestserver.com/api/user/someapicall';      let headers = new headers({          "content-type": "application/x-www-form-urlencoded"     });     let options = new requestoptions({ headers: headers, withcredentials: true });      return this.http.post(url, 'username=' + username + '&password=' + password, options)         .map(res => {             console.log(res);             let cookies = res.headers.getall('set-cookie');             console.log(cookies);         })         .catch(this.handleerror); } 

the problem when call this, fiddler shows me these response headers:

enter image description here

but when check response object printed in console, not contain header references cookie. know problem??

for security reasons cookies http-only, httponly @ end of cookie header:

set-cookie:.aspnetcore.identity.application=...; expires=...; secure; httponly 

this means cookie hidden js - browser hold , include request make domain/path, client side js cannot access @ all.

in chrome extension can access these cookies, not in content script or injected code.

i'm using chrome-extension-async async/await support, , chrome.cookies extension api:

async function getcookies() {     var cookies = await chrome.cookies.getall();     for(let cookie of cookies)         // cookie.httponly true hidden cookies         console.log(cookie);  } 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -