Access to cookie jar denied

I have the following as part of a pre-request script in the attempt to read cookies and transfer them so they are part of every request and I can automate testing of my APIs.

const jar = pm.cookies.jar();
jar.getAll('/', (error, cookies) =>
    {
        if (error) {
            console.log(error);
        } else {
            console.log(cookies);
        }
    });

The problem is that I get an error with a message property ‘CookieStore: programmatic access to “” is denied’. I am running this Postman request on localhost and I have “whitelisted” localhost as defined in the documentation. What am I doing wrong?

Even I am getting the same error inspite whitelisting ip.

const jar = pm.cookies.jar();

jar.clear(pm.request.url, function (error, cookies) {
console.info(error);

});

message in console
CookieStore: programmatic access to “” is denied

I whitelisted the cookie and after that, this code worked in Tests.
const jar = pm.cookies.jar();
jar.clear(pm.request.url, function (error) {
console.log(error);
});


You should add domain into the allowlist.

I have tried the solutions like allowing or whitelisting domain or reinstalling the postman.
Upon trying to reinstall, I have found that, I have been using Interceptor to sync browser cookies of domain in postman, which created the access denied issue as you are trying to delete the cookies that the Interceptor has synced.

So try to disable the sync cookies using Postman Interceptor in postman and remove its browser extension (Postman Interceptor). Which solved me this issue.

1 Like