title: Chrome not allowing Set-Cookie even from the same (sub)domain
body: <p>Here is my configuration:</p>
  <p><strong>SERVER</strong></p>
  <p>Laravel 8 application that uses Sanctum to provide access to REST API. It is configured to run on <code>http://b8/</code></p>
  <p><strong>CLIENT</strong></p>
  <p>A separate Vue CLI 3.0 SPA that connects to the API using session-based cookie authentication method. I have configured Vue CLI Serve to run it at <code>http://app.b8/</code>.</p>
  <p><strong>PROBLEM</strong></p>
  <p>Chrome does not allow Set-Cookie operation even when both server and client are on the same domain. After going through several posts and articles, I have successfully run it in Postman, but the real Vue application that runs in the browser can't set Sanctum cookie and thus cannot login.</p>
  <p>Here is my configuration:</p>
  <p><strong>.env</strong></p>
  <pre><code>SESSION_DRIVER=cookie
  SESSION_DOMAIN=.b8
  SANCTUM_STATEFUL_DOMAINS=localhost,localhost:8080,127.0.0.1,127.0.0.1:8000,::1,b8,app.b8,app.b8:8080
  </code></pre>
  <p><strong>vue.config.js</strong></p>
  <pre><code>...
  devServer: {
      proxy: &quot;http://b8/api/v1&quot;, 
      host: &quot;app.b8&quot;
  },
  </code></pre>
  <p><strong>Login function in Vue application</strong></p>
  <pre><code>async login(context, credentials) {
      axios.get('http://b8/sanctum/csrf-cookie').then(response =&gt; {
          axios.post('http://b8/login', credentials).then(response2 =&gt; {
            //successfully logged in.
          });
      });            
  },
  </code></pre>
  <p><strong>Error msg</strong></p>
  <p>The outer call for <code>/sanctum/csrf-cookie</code> route returns successfully and brings Sanctum cookie. However, Chrome thinks that the cookie is invalid for the current domain and therefore doesn't set it. Here is the Dev Tools pane's Cookies tab after the Sanctum token call returns (tooltip showing Chrome's complaint):</p>
  <p><a href="https://i.stack.imgur.com/hVQ5C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hVQ5C.png" alt="enter image description here" /></a></p>
  <p>Since the cookie is not set, the following <code>login</code> call fails with a <code>419</code> error.</p>
  <p>What am I missing here?</p>