I'm making authentication with passport, but I get the following error.

`401 Unauthorized` response: {" error ":" invalid_client "," error_description ":" Client authentication failed "," message ":" Client authentication failed "}

The executed command and code are as follows.

$php artisan passport: client --personal
What should we name the password grant client? [Laravel Password Grant Client]:
$user = User :: nullDeleteAt ()->find (Auth :: id ());
$http = new Client;
$host = config ('app.url');
$response = $http->post ($host. '/ oauth/token', [
  'form_params' =>[
      'email' =>$user->email,
      'password' =>'hogehoge',
      'username' =>$user->email,
      'grant_type' =>'password',
      'client_id' =>'2',
      'client_secret' =>config ('auth.client_secret'),
return redirect ('/ mypage')->with ('verified', true)->with ('access_token', (string) $response->getBody (), true);
  • Answer # 1

    $php artisan passport: client --personal
    I changed the above to the following and modified client_id.
    $php artisan passport: client --password

Related articles