title: How can I authenticate a request using Laravel Passport having the access token in query string instead of in header?
body: <p>Authentication works fine using <code>'middleware' =&gt; 'auth:api'</code> on regular endpoints where the client sends the <code>Authorization=Bearer &lt;access_token&gt;</code>.</p>
  
  <p>But now I'd like to handle plain image download requests, without Authorization header, having the access token in the query string like this: <code>GET /picture/my_picture.png?access_token=1234</code>.</p>
  
  <p>I tried something like this in my middleware, but I can't seem to add headers to the Request:</p>
  
  <pre><code>if ($request-&gt;has('access_token')) {
      // something like $request-&gt;header-&gt;set('Authorization', 'Bearer ' . $request-&gt;get('access_token'));
  }
  
  if ($this-&gt;auth-&gt;guard($guard)-&gt;guest()) {
      // throw exception
  }
  </code></pre>
  
  <p>Can this be done? Maybe intercept or override something/somewhere else?</p>