Cannot access cookie "connect.sid"

I am trying to use chained request to mimic the flow of logging in to our application and then formulating a POST command. In the response header of my login request, there is Set-Cookie that sets two cookies named _csrf and connect.sid. I need to use both of these cookies for my subsequent chained POST request, however I only seem to have visibility to the _csrf cookie.

If I use

postman.getResponseHeader("Set-Cookie"))

the result is something like

{_csrf: "Gs2Bdmb_Yy7om3zkdON2-Erf"}

Yet when I perform the same request in my browser, I see both cookies.

image

Why is this cookie not visible in Postman?

Thanks for any help.

@mab1618 can you check if the cookie is having “Secure” flag ?
Is “connect.sid” saved to your cookie jar ? check Manage cookies in postman.

Yes, both cookies have a secure flag.

I wasn’t sure that I needed to implement a cookie jar since I am only trying to harvest the cookie values from a Response to use in subsequent Requests. I am not creating any new cookies. I thought, maybe incorrectly, that using pm.getResponseHeader to store the values in variables or just having Postman natively use the cookies would be adequate. In both cases, only the _csrf cookie is available in the getResponseHeader method and in the “Cookies” section of the response in the Postman UI after my login request. Also, I don’t actually see the “Set-Cookie” property in the Postman UI or Postman console in the Response, but the pm.getResponseHeader(“Set-Cookie”) returns the results I mentioned in my original post.

When I perform the same request in my browser and view the Response header, I see the Set-Cookie property with both cookies in it. When I view the cookies in browser console, both of the cookies are there.

@mab1618 you have to use pm.cookies to access any cookie programatically.
Refer the documentation here: https://learning.postman.com/docs/postman/sending-api-requests/cookies/#programmatic-access-of-cookies

Postman has an existing bug related to accessing secure cookies: https://github.com/postmanlabs/postman-app-support/issues/7977

I have found a temporary workaround i accessing a secure cookie using pm.cookies.jar()
Refer this: https://stackoverflow.com/questions/60001892/pm-cookies-jar-could-not-find-cookies-with-secure-true/60077320