HTTP Cookie won't get set

default discord avatar
TheFrontendlast year

Can someone send me a screenshot of a successful login request that sets an http only cookie? Right now I'm receiving the cookie but it won't get set in the browser and I'm a bit stuck. 👀

@jmikrut I just found out that for cross-site requests the cookie needs to be set "secure": "true" and "same-site": "none". That solved my issue. Would be good to have this option within the payload config to avoid patching the dependency. 🙌

  • discord user avatar
    last year

    these two options are indeed configurable in the payload config already 👍

    check out the



    you can set


    as well as


    right in the config, based on ENV vars or whatever you need 👍

  • default discord avatar
    TheFrontendlast year

    Haha, oh no! Guess I was blind 😅

  • default discord avatar
    Sandro Wegmannlast year

    I wanted to follow up on this real quick, because I've wasted countless hours on those cookie issues during my years in web dev.

    If you are using axios or sth similar, you need to set withCredentials": true (or credentials: 'include' in node fetch ). NOT ONLY ON THE REQUEST USING THE AUTH COOKIE, BUT ALSO ON THE REQUEST WHERE YOU WANT TO RETRIEVE THE AUTH COOKIE (e.g. login request). Otherwise, you'll see the set-Cookie header in the response, but no cookie will be set
  • discord user avatar
    last year

    ^^^^ 100%

Star on GitHub


Chat on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.