How to delete session cookie in Postman?

后端 未结 12 1388
渐次进展
渐次进展 2020-12-05 01:18

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,

相关标签:
12条回答
  • 2020-12-05 01:58

    Have you tried Clear Cache extension? Give it a try. It clears app cache, downloads, file systems, form data, history, local storage, passwords and much more, available in the Options settings.

    Update: try this answer https://superuser.com/a/232794

    I'm not sure of a way to do this in Postman. I used to close the whole browser and reset the server in order to authenticate again. Never tested logout because it was an API service.

    0 讨论(0)
  • 2020-12-05 02:00

    I tried clearing the chrome cookies to get rid of postman cookies, as one of the answers given here. But it didn't work for me. I checked my postman version, found that it's an old version 5.5.4. So I just tried a Postman update to its latest version 7.3.4. Cool, the issue fixed !!

    0 讨论(0)
  • 2020-12-05 02:07

    into Chrome, right click -> Inspect Element. Go to the tab active tracking of resources and if you have not already. Now the left hand sidebar thingy down until you see "Cookies", click below your domain name and to remove a cookie just right-click on it and "Delete"

    0 讨论(0)
  • 2020-12-05 02:08

    I think the response of aaron can be enhanced for URL that contains variables:

    var sdk = require('postman-collection');      
    
    const testURL=pm.environment.values.substitute(pm.request.url, null, false);
    
    const objURL=new sdk.Url(testURL);
    
    console.log("clearing cookies for: "+testURL);
    
    const jar = pm.cookies.jar();
    
    jar.clear(objURL, function (error) {
      // error - <Error>
      if(error)
      console.log("Error clearing cookies: "+error);
    });
    
    0 讨论(0)
  • 2020-12-05 02:09

    In the Native Postman app there is "Cookie manager", so that is not a problem at all,

    But in the Postman extension for Chrome there is not

    So the solution is just in the installing native Postman

    Postman for Linux, Mac & Windows

    0 讨论(0)
  • 2020-12-05 02:10

    Manually deleting it in the chrome browser removes the cookie from Postman.

    In your chrome browser go to chrome://settings/cookies

    Find the cookie and delete it

    Edit: As per Max890 comment below (in my version of Google Chrome (ver 63)) this is now chrome://settings/content/cookies Then go to "See all cookies and site data"

    Update for Google Chrome 79.0.3945.88

    chrome://settings/siteData?search=cookies

    0 讨论(0)
提交回复
热议问题