126

I read the manual of sending request with cookie with postman:

As the packaged app runs in a sandbox separately from the browser, it can not access cookies set inside the browser. This restriction can also be overcome using the Interceptor extension. Postman routes all requests through the Interceptor, which then uses the browser context to send requests. Cookies set inside the browser are automatically attached to your requests. Read the original blog post on Interceptor.

Once the interceptor is enabled, you can also send cookies from Postman. Just set the "Cookie" header, and the cookie will be sent with the request. You can also get access to cookies that are available when the response is returned. Check out out blog post for more

So I downloaded the interceptor for google chrome, and it enable.

Also, I add the following to postman: Cookie JSESSIONID=daczcz36789

When I look at the network I notice that the Cookie is not sent.

What I do wrong?

MIDE11
  • 3,140
  • 7
  • 31
  • 53
  • Very helpful related post [here](https://stackoverflow.com/q/24472239/465053). – RBT Dec 07 '17 at 05:41
  • 1
    Postman Chrome app has been deprecated in the favor of native apps. So it is better to go for native app (in place of Chrome apps) which has direct support for intercepting cookies as mentioned in [my answer](https://stackoverflow.com/a/47692862/465053). You will not require additional plugins like interceptor to check cookies when you use native apps. – RBT Dec 08 '17 at 00:04
  • Does this answer your question? [How to store and reuse cookies in Postman?](https://stackoverflow.com/questions/27226342/how-to-store-and-reuse-cookies-in-postman) – Son Nguyen Dec 19 '20 at 10:14

8 Answers8

164

I used the postman chrome extension until it became deprecated. Chrome extension is also less usable and powerful than the native postman application. Hence it became very inconvenient to use the chrome extension.

I have found another approach:

  1. copy any request in chrome/any other browser as a CURL request copy curl request
  2. import to postman copied request import to postman copied request
  3. save imported request in the postman's list
Vaha
  • 2,179
  • 2
  • 17
  • 29
54

You can enable Interceptor in browser and in Postman separately. For send/recieve cookies you should enable Interceptor in Postman. So if you enable interceptor only in browser - it will not work. Actually you don't need enable Interceptor in browser at all - if you don't want to flood your postman history with unnecessary requests.

xxldoctor
  • 556
  • 6
  • 3
  • 1
    how can i mimic this in my code. i want to send and receive cookie. otherwise server is not authenticating me. – Sagar Nayak Jul 01 '17 at 08:00
  • I'm having the same problem and setting the intercepter off then back on did NOT help me. Postman support was no help either. They told me to use the desktop version of Postman which is giving me the same response. When I click under "Cookies", I do see the cookie issued by my site but if I check my API call in Fiddler, I don't see the cookie my site issued being sent. – Sam Sep 21 '17 at 18:52
  • @SagarNayak did you found any way to do so in code? – Jay Patel Dec 16 '19 at 05:44
  • @JayPatel I dint find any solutions. I changed the flow of that use case and worked around it. – Sagar Nayak Dec 16 '19 at 10:51
  • Okay, I think I also need to do something like that! – Jay Patel Dec 16 '19 at 11:19
46

Enable intercepter in this way

Basically it is a chrome plug in. After installing the extention, you also need to make sure the extention is enabled from chrome side.

enter image description here

Community
  • 1
  • 1
Fangming
  • 24,551
  • 6
  • 100
  • 90
34

Based @RBT's answer above, I tried Postman native app and want to give a couple of additional details.

In the latest postman desktop app, you can find the cookies option on the extreme right:

enter image description here

You can see the cookies for your localhost (these cookies are linked with the cookies in your chrome browser, although the app is running natively). Also you can set the cookies for a particular domain too.

enter image description here

tryingToLearn
  • 10,691
  • 12
  • 80
  • 114
19

You should enable your interceptor extension man manually, it locate in the top-right of your postman window. There are several buttons, find the interceptor button and enable it, then you can send cookies after set Cookie field in your request headers.

GuoX
  • 421
  • 5
  • 8
7

Chrome apps including Postman are being deprecated as mentioned here. Now the recommendation is to go for native apps which are not detached from the sandboxed environment of the browser.

Quoting from the feature page:

FEATURES EXCLUSIVE TO THE NATIVE APPS:

COOKIES: The native apps let you work with cookies directly. Unlike the Chrome app, no separate extension (Interceptor) is needed.

BUILT-IN PROXY: The native apps come with a built-in proxy that you

can use to capture network traffic.

RESTRICTED HEADERS: The latest version of the native apps let you send headers like Origin and User-Agent. These are restricted in the Chrome app. DON'T FOLLOW

REDIRECTS OPTION: This option exists in the native apps to prevent requests that return a 300-series response from being automatically redirected. Previously, users needed to use the Interceptor extension to do this in the Chrome app.

MENU BAR: The native apps are not restricted by the Chrome standards for the menu bar.

POSTMAN CONSOLE: The latest version of the native apps has a built-in console, which allows you to view the network request details for API calls.

So once you install the native Postman app from here, you don't have to go looking for additional Chrome extensions like Interceptor. Earlier, Postman Interceptor like apps were an additional requirement if we wanted to check browser cookies. All the cookies were visible in Cookies tab as shown below:

enter image description here

RBT
  • 24,161
  • 21
  • 159
  • 240
5

I was having issues getting this working (on OSX). I'd followed the instructions provided by Postman, and the advice here, and cookies were still not being set.

However, the post above saying "So if you enable interceptor only in browser - it will not work" alerted me to the fact that the interceptor could be enabled in the browser as well as in Postman itself. I thought I'd try switching it on in the browser, to see if that helped, and it did. I then switched it off in the browser, and it still worked.

So, if you are having issues getting it working, I'd suggest trying switching it on in browser at least once, as, for me, this seemed to trigger it into life. I think you will still need it switch on in Postman too.

lukens
  • 479
  • 4
  • 10
  • 1
    On OS X 10.11.6 toggling the interceptor addon on the Chrome browser did it for me. Thanks a lot! – Paul Corda Sep 07 '16 at 12:15
  • Just wanted to confirm that turning the interceptor addon in Chrome on, then back off, also worked for me on OSX 10.11.6. – carbocation Nov 26 '16 at 19:05
4

Even after toggling it did not work. I closed and restarted the browser after adding the postman plugin, logged into the site to generate cookies afresh and then it worked for me.

KRISHNA R
  • 41
  • 2