title: Generate laravel passport tokens internally. 401 error unauthorized
body: <p>I'm trying to create a bearer token for passport so I can use my api routes internally. I send a post request to /oauth/token with the client id and client secret. The code that generates the bearer token looks like this.</p>
  
  <pre><code>public function generateToken() {
      try {
          $req = Request::create('/oauth/token', 'POST', [
              'grant_type' =&gt; 'client_credentials',
              'client_id' =&gt; '1',
              'client_secret' =&gt; 'POe81tKvmZ0DhBdtwdM7VPoV5tTKobVYzSc9A0RX',
              'scope' =&gt; '*',
          ]);
          $res = app()-&gt;handle($req);
          return $res;
      } catch (Exception $e){
          log::critical('Failed to generate bearer token.');
      } catch (error $e) {
          log::critical('Failed to generate bearer token.');
      }
  
  }
  </code></pre>
  
  <p>However when trying to do this request I get a 401 authorised.</p>
  
  <pre><code>  #content: "{"error":"invalid_client","message":"Client authentication failed"}" #version: "1.1"#statusCode: 401 #statusText: "Unauthorized"
  </code></pre>
  
  <p>Is there anyway of fixing this?</p>