title: Laravel as a proxy and cookie handling with guzzle
body: <p>Here's the deal, one AngularJS app makes a post login request to my API (Laravel). Then Laravel does a request with Guzzle to another API. This API returns a cookie, which Laravel will send over to AngularJS.</p>
  
  <p>Now on subsequent requests made by AngularJS, this cookie is sent, Laravel injects it on subsequent Guzzle requests.</p>
  
  <p>My login method:</p>
  
  <pre><code>public function login(AuthRequest $request)
      {
          $credentials = $request-&gt;only('email', 'password');
          $response = $this-&gt;httpClient-&gt;post('_session', [
              'form_params' =&gt; [
                  'name'     =&gt; $credentials['email'],
                  'password' =&gt; $credentials['password']
              ]
          ]);
  
          return $this-&gt;respond($response-&gt;getHeader('Set-Cookie'));
      }
  </code></pre>
  
  <p>How do I "sync" the Laravel cookie and the Guzzle cookie?</p>
  
  <p>I'm using Laravel 5 and the latest Guzzle (6.0.1).</p>