title: 401 Unauthorized by following laracast laravel passport tutorial
body: <p>i'am following laracast tutorial about laravel passport in <a href="https://laracasts.com/series/whats-new-in-laravel-5-3/episodes/13" rel="nofollow noreferrer">here</a> and i following exactly the same with tutorial.</p>
  
  <p>but i got this error when i click authorized button in requesting authorization</p>
  
  <pre><code>Client error: `POST http://laravelserver.local/oauth/token` resulted in a `401 Unauthorized` response:
  {"error":"invalid_client","message":"Client authentication failed"}
  </code></pre>
  
  <p>is it some kind of bug that appear in laravel 5.4? since the tutorial is intended for laravel 5.3</p>
  
  <p>just like in the tutorial i create 2 laravel app, laravelserver.local and laravelclient.local</p>
  
  <p>in laravelserver i install passport and auth, also using passport vue component.</p>
  
  <p>and next i create laravelclient.local, i install passport too, and also install guzzlehttp. here is my route</p>
  
  <pre><code>use Illuminate\Http\Request;
  
  Route::get('/',function(){
      $query = http_build_query([
          'client_id' =&gt; 3,
          'redirect_uri' =&gt; 'http://laravelclient.local/callback',
          'response_type' =&gt; 'code',
          'scope' =&gt; '',
      ]);
  
      return redirect('http://laravelserver.local/oauth/authorize?'.$query);
  });
  
  Route::get('/callback', function(Request $request){
      $http = new GuzzleHttp\Client;
  
      $response = $http-&gt;post('http://laravelserver.local/oauth/token',[
          'form_params' =&gt; [
              'grant_type' =&gt; 'authorization_code',
              'client_id' =&gt; 3,
              'client_secret' =&gt; 'sVyq48StpzKfivvimxcRKPzIhek0cgDhfPx4kWqo',
              'redirect_uri' =&gt; 'http://laravelclient.local/callback',
              'code' =&gt; $request-&gt;code,
          ]
      ]);
  
      return json_decode((string) $response-&gt;getBody(), true);
  });
  </code></pre>
  
  <p>and in my laravelserver database (using mysql since i am running everything in XAMPP on windows 10)
  oauth_clients table i have 3 record</p>
  
  <ol>
  <li><strong>id</strong>:1, <strong>user_id</strong>:null, <strong>name</strong>:Laravel Personal Access Client, <strong>secret</strong>:fnjYwNlvSMWbODmqIRHZcXFm7kvijYjs9TthHWxW, <strong>redirect</strong>:<a href="http://localhost" rel="nofollow noreferrer">http://localhost</a>, <strong>personal_access_client</strong>:1, <strong>password_client</strong>:0, <strong>revoked</strong>:0</li>
  <li><strong>id</strong>:2, <strong>user_id</strong>:null, <strong>name</strong>:Laravel Password Grant Client, <strong>secret</strong>:s8xLgyjq8r5KEq8XeX1030wQfKIVy5QvxPNC81OG, <strong>redirect</strong>:<a href="http://localhost" rel="nofollow noreferrer">http://localhost</a>, <strong>personal_access_client</strong>:0, <strong>password_client</strong>:1, <strong>revoked</strong>:0</li>
  <li><strong>id</strong>:3, <strong>user_id</strong>:1, <strong>name</strong>:laravelclient, <strong>secret</strong>:sVyq48StpzKfivvimxcRKPzIhek0cgDhfPx4kWqo, <strong>redirect</strong>:<a href="http://laravelclient.local/callback" rel="nofollow noreferrer">http://laravelclient.local/callback</a>, <strong>personal_access_client</strong>:0, <strong>password_client</strong>:0, <strong>revoked</strong>:0</li>
  </ol>
  
  <p>and in oauth_auth_codes table only have 1 record</p>
  
  <p><strong>user_id</strong>:1, <strong>id</strong>:8a07951bae2aa50a55ed615785800681d7a5dbd44beccea26638bb43bf218c8e573da5f303a56082, <strong>client_id</strong>:3, <strong>scopes</strong>:[], <strong>revoked</strong>:0, <strong>expires_at</strong>:2017-07-21 07:30:15</p>
  
  <p>so it is exactly like in that tutorial and i also find this question been ask in <a href="https://github.com/laravel/passport/issues/221" rel="nofollow noreferrer">github</a> but no working answer</p>
  
  <p><strong>update</strong></p>
  
  <p>also i have add this in host file</p>
  
  <pre><code>127.0.0.1    laravelserver.local
  127.0.0.1    laravelclient.local
  </code></pre>
  
  <p>and add this to httpd-vhosts.conf</p>
  
  <pre><code>&lt;VirtualHost laravelserver.local:80&gt;
      DocumentRoot "C:\xampp\htdocs\laravelserver\public"
      ServerAdmin laravelserver.local
      &lt;Directory "C:\xampp\htdocs\laravelserver"&gt;
          Options Indexes FollowSymLinks
          AllowOverride All
          Require all granted
      &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost laravelclient.local:80&gt;
      DocumentRoot "C:\xampp\htdocs\laravelclient\public"
      ServerAdmin laravelclient.local
      &lt;Directory "C:\xampp\htdocs\laravelclient"&gt;
          Options Indexes FollowSymLinks
          AllowOverride All
          Require all granted
      &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>