title: How to send cookie token using axios?
body: <p>Here's my code for generating token that will response as a cookie.</p>
  
  <pre><code>public function authenticate(Request $request)
  {
      // grab credentials from the request
  
      $credentials = ['email'=&gt;$request-&gt;header('email'),'password'=&gt;$request-&gt;header('password')];
  
      try {
          // attempt to verify the credentials and create a token for the user
          if (! $token = JWTAuth::attempt($credentials)) {
              return response()-&gt;json(['error' =&gt; 'invalid_credentials'], 401);
          }
      } catch (JWTException $e) {
          // something went wrong whilst attempting to encode the token
          return response()-&gt;json(['error' =&gt; 'could_not_create_token'], 500);
      }
  
      return response($token)-&gt;cookie(
          'token',$token, 60
      );
  
  }
  </code></pre>
  
  <p>And I'm using axios to process it. Here's my code:</p>
  
  <pre><code>axios({
        method: 'post',
        url: 'http://test.dev/authenticate',
        headers : {
          'email':'test@gmail.com',
          'password':'secret'
        },
        json:true,
      })
   axios({
        method: 'get',
        url: 'http://test.dev/api/users', 
        json:true,
        withCredentials: true
      });
  </code></pre>
  
  <p>Now, I'm having a problem on how to send the token to retrieve users list. I've tried to add withCredentials: true but no luck.</p>
  
  <p>I got a response error token_not_provided. </p>
  
  <p>Questions:</p>
  
  <ol>
  <li>How to get the value of the cookie token from response?</li>
  <li>How to send the token using axios with Authorization Bearer {token}?</li>
  </ol>
  
  <p>Thank you In Advance.</p>