I am testing my API in Postman and am having trouble simulating a log out.
If I do a call to delete the session cookie,
Postman 4.0.5 has a feature named Manage Cookies located below the Send button which manages the cookies separately from Chrome it seems.
new version of postman app has the ability to do that programmatically in pre-request or tests scripts since 2019/08
see more examples here: Delete cookies programmatically · Issue #3312 · postmanlabs/postman-app-support
const jar = pm.cookies.jar();
jar.clear(pm.request.url, function (error) {
// error - <Error>
});
const jar = pm.cookies.jar();
jar.getAll('http://example.com', function (error, cookies) {
// error - <Error>
// cookies - <PostmanCookieList>
// PostmanCookieList: https://www.postmanlabs.com/postman-collection/CookieList.html
});
const jar = pm.cookies.jar();
jar.get('http://example.com', 'token', function (error, value) {
// error - <Error>
// value - <String>
});
Note that this answer applies only to the standalone Postman UI and not the Postman app/add-on for Chrome.
How to clear the cache in Postman (so that you are required to log in again when requesting a token, for example):
As @markus said use the "Cookie Manager" and delete the cookie.
If you want to learn how to set destroy cookies in postman, You should check the Postman Echo service https://docs.postman-echo.com/
There you will find complete explanation on how to Set, Get and Delete those cookies.
Check it on : https://docs.postman-echo.com/#3de3b135-b3cc-3a68-ba27-b6d373e03c8c
Give it a Try.
Is the Postman Interceptor enabled? Toggling it will route all requests and responses through the Chrome browser.
Interceptor - https://www.getpostman.com/docs/capture Cookies documentation - http://blog.getpostman.com/index.php/2014/11/28/using-the-interceptor-to-read-and-write-cookies/
You can use the Postman interceptor.That you can add into the chrome extension by this link:https://chrome.google.com/webstore/detail/postman-interceptor/aicmkgpgakddgnaphhhpliifpcfhicfo
This helps you send requests which use browser cookies through the Postman app. It can also send headers which are normally restricted by Chrome but are critical for testing APIs.
And also you can enable by interceptor which is there beside the orange sync icon