Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hardcoderrsl's avatar

Urgent help needed, even google couldn't answer- please help. Laravel test fails..

I'm using virtual test database for my testing. my API is working with postman. but creating problem when writing test. when I execute the test it shows a long list of error containing the following message below-

"message": "Client error: POST http://localhost/oauth/token resulted in a 401 Unauthorized response:\n{"error":"invalid_client","message":"Client authentication failed"}

here is my route-

Route::post('/v1/create', 'API\v1\UserController@register'); here is my controller

public function register(Request $request) {

$validator = Validator::make($request->all(), [ 
    'name' => ['required', 'string', 'max:255'],
    'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
    'password' => ['required', 'string', 'min:6', 'confirmed'],
]);
if ($validator->fails()) { 
            return response()->json(['error'=>$validator->errors()], 401);            
        }
$input = $request->all(); 
$input['password'] = bcrypt($input['password']); 
$user = User::create($input); 


$http=new Client;

$response=$http->post(url("/oauth/token"),[
    'form_params'=>[
        'grant_type'    =>'password',
        'client_id'     =>$request->client_id,
        'client_secret' =>$request->client_secret,
        'password'      =>$request->password,
        'username'      =>$request->email,
        'scope'         =>''             
        ]
    ]);
// return response()->json(['success'=>$response], $this->successStatus); 
return $response;

} and here is my test-

namespace Tests\Feature\API\v1;

use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
use App\User;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use PharIo\Manifest\Email;

class UserTest extends TestCase
{
use WithFaker;
use DatabaseMigrations;
public $mockConsoleOutput = false;

/** @test */
public function a_user_can_create_user(){
$user= factory(User::class)->create(); //create user
$login=$this->actingAs($user,'api'); //user login with api

 //create password grant client
  $this->artisan('passport:client', ['--password' =>true, '--no-interaction' => true, '-- 
  redirect_uri'=>'http://localhost', '--name'=>'test client']);
  // fetch client for id and secret
  $client = \DB::table('oauth_clients')->where('password_client', 1)->first();

 // dd($client->getData());


 $email=$this->faker->email();
 $password=$this->faker->password;
 $newUser=$this->json('POST','/api/v1/create',[
'grant_type'     =>'password',
'client_id'     => $client->id,
'client_secret' => $client->secret,
'name' => $this->faker->name(),
'email' => $email,
'password' => $password,
'password_confirmation' => $password,
'remember_token' => str_random(10),
 ]);


// ->assertJsonStructure(['access_token', 'refresh_token']);



 dd($newUser);
 // $this->assertDatabaseHas('users',['email'=>$email]);
  // $newUser->assertJsonFragment(['token_type'=>'Bearer']);
 }


 }

please help me what am I missing? and guide me what should I do now?

0 likes
10 replies
skoobi's avatar

Have you checked the test .env file. When you run tests, it creates a separate .env file to run.

You can create a .env.testing file to add your credentials etc for the test environment.

https://laravel.com/docs/5.7/testing

Thats my only idea on it i think. :)

hardcoderrsl's avatar

@skoobi thank you for your suggestion. I've tried .env.testing but the problem exists same. I think the problem is on this line of the controller-

$response=$http->post(url("/oauth/token"),[
'form_params'=>[
    'grant_type'    =>'password',
    'client_id'     =>$request->client_id,
    'client_secret' =>$request->client_secret,
    'password'      =>$request->password,
    'username'      =>$request->email,
    'scope'         =>''             
    ]
]);

when guzzle is posting data to oauth/token endpoint- that end point is acting as real environment rather than testing environment. not sure how do I overcome this problem. "oauth/token" is serving as PROD mode rather than testing mode.

tomopongrac's avatar

Try to create password grant before login user

//create password grant client
  $this->artisan('passport:client', ['--password' =>true, '--no-interaction' => true, '-- 
  redirect_uri'=>'http://localhost', '--name'=>'test client']);
  // fetch client for id and secret
  $client = \DB::table('oauth_clients')->where('password_client', 1)->first();

$user= factory(User::class)->create(); //create user
$login=$this->actingAs($user,'api'); //user login with api
hardcoderrsl's avatar

@tomopongrac thank you! but still same problem_ PHPUnit 7.5.2 by Sebastian Bergmann and contributors.

    ...Illuminate\Foundation\Testing\TestResponse {#2061
      +baseResponse: Illuminate\Http\JsonResponse {#2128
        #data: """
          {\n
              "message": "Client error: `POST http://localhost/oauth/token` resulted in a `401 Unauthorized` response:\n{\"error\":\"invalid_client\",\"message\":\"Client authentication failed\"}\n",\n
              "exception": "GuzzleHttp\Exception\ClientException",\n
              "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php",\n
              "line": 113,\n
              "trace": [\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\guzzle\src\Middleware.php",\n
                      "line": 66,\n
                      "function": "create",\n
                      "class": "GuzzleHttp\Exception\RequestException",\n
                      "type": "::"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php",\n
                      "line": 203,\n
                      "function": "GuzzleHttp\{closure}",\n
                      "class": "GuzzleHttp\Middleware",\n
                      "type": "::"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php",\n
                      "line": 156,\n
                      "function": "callHandler",\n
                      "class": "GuzzleHttp\Promise\Promise",\n
                      "type": "::"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\TaskQueue.php",\n
                      "line": 47,\n
                      "function": "GuzzleHttp\Promise\{closure}",\n
                      "class": "GuzzleHttp\Promise\Promise",\n
                      "type": "::"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php",\n
                      "line": 246,\n
                      "function": "run",\n
                      "class": "GuzzleHttp\Promise\TaskQueue",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php",\n
                      "line": 223,\n
                      "function": "invokeWaitFn",\n
                      "class": "GuzzleHttp\Promise\Promise",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php",\n
                      "line": 267,\n
                      "function": "waitIfPending",\n
                      "class": "GuzzleHttp\Promise\Promise",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php",\n
                      "line": 225,\n
                      "function": "invokeWaitList",\n
                      "class": "GuzzleHttp\Promise\Promise",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php",\n
                      "line": 62,\n
                      "function": "waitIfPending",\n
                      "class": "GuzzleHttp\Promise\Promise",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\guzzle\src\Client.php",\n
                      "line": 131,\n
                      "function": "wait",\n
                      "class": "GuzzleHttp\Promise\Promise",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\guzzle\src\Client.php",\n
                      "line": 89,\n
                      "function": "request",\n
                      "class": "GuzzleHttp\Client",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\app\Http\Controllers\API\v1\UserController.php",\n
                      "line": 72,\n
                      "function": "__call",\n
                      "class": "GuzzleHttp\Client",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "function": "register",\n
                      "class": "App\Http\Controllers\API\v1\UserController",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Controller.php",\n
                      "line": 54,\n
                      "function": "call_user_func_array"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php",\n
                      "line": 45,\n
                      "function": "callAction",\n
                      "class": "Illuminate\Routing\Controller",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Route.php",\n
                      "line": 219,\n
                      "function": "dispatch",\n
                      "class": "Illuminate\Routing\ControllerDispatcher",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Route.php",\n
                      "line": 176,\n
                      "function": "runController",\n
                      "class": "Illuminate\Routing\Route",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Router.php",\n
                      "line": 682,\n
                      "function": "run",\n
                      "class": "Illuminate\Routing\Route",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 30,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Router",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php",\n
                      "line": 41,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 151,\n
                      "function": "handle",\n
                      "class": "Illuminate\Routing\Middleware\SubstituteBindings",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 53,\n
                      "function": "Illuminate\Pipeline\{closure}",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Middleware\ThrottleRequests.php",\n
                      "line": 58,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 151,\n
                      "function": "handle",\n
                      "class": "Illuminate\Routing\Middleware\ThrottleRequests",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 53,\n
                      "function": "Illuminate\Pipeline\{closure}",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 104,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Router.php",\n
                      "line": 684,\n
                      "function": "then",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Router.php",\n
                      "line": 659,\n
                      "function": "runRouteWithinStack",\n
                      "class": "Illuminate\Routing\Router",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Router.php",\n
                      "line": 625,\n
                      "function": "runRoute",\n
                      "class": "Illuminate\Routing\Router",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Router.php",\n
                      "line": 614,\n
                      "function": "dispatchToRoute",\n
                      "class": "Illuminate\Routing\Router",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",\n
                      "line": 176,\n
                      "function": "dispatch",\n
                      "class": "Illuminate\Routing\Router",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 30,\n
                      "function": "Illuminate\Foundation\Http\{closure}",\n
                      "class": "Illuminate\Foundation\Http\Kernel",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\fideloper\proxy\src\TrustProxies.php",\n
                      "line": 57,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 151,\n
                      "function": "handle",\n
                      "class": "Fideloper\Proxy\TrustProxies",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 53,\n
                      "function": "Illuminate\Pipeline\{closure}",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php",\n
                      "line": 31,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 151,\n
                      "function": "handle",\n
                      "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 53,\n
                      "function": "Illuminate\Pipeline\{closure}",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php",\n
                      "line": 31,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 151,\n
                      "function": "handle",\n
                      "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 53,\n
                      "function": "Illuminate\Pipeline\{closure}",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php",\n
                      "line": 27,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 151,\n
                      "function": "handle",\n
                      "class": "Illuminate\Foundation\Http\Middleware\ValidatePostSize",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 53,\n
                      "function": "Illuminate\Pipeline\{closure}",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php",\n
                      "line": 62,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 151,\n
                      "function": "handle",\n
                      "class": "Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 53,\n
                      "function": "Illuminate\Pipeline\{closure}",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 104,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",\n
                      "line": 151,\n
                      "function": "then",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",\n
                      "line": 116,\n
                      "function": "sendRequestThroughRouter",\n
                      "class": "Illuminate\Foundation\Http\Kernel",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Testing\Concerns\MakesHttpRequests.php",\n
                      "line": 345,\n
                      "function": "handle",\n
                      "class": "Illuminate\Foundation\Http\Kernel",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Testing\Concerns\MakesHttpRequests.php",\n
                      "line": 317,\n
                      "function": "call",\n
                      "class": "Illuminate\Foundation\Testing\TestCase",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\tests\Feature\API\UserTest.php",\n
                      "line": 52,\n
                      "function": "json",\n
                      "class": "Illuminate\Foundation\Testing\TestCase",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\Framework\TestCase.php",\n
                      "line": 1153,\n
                      "function": "a_user_can_create_user",\n
                      "class": "Tests\Feature\API\v1\UserTest",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\Framework\TestCase.php",\n
                      "line": 842,\n
                      "function": "runTest",\n
                      "class": "PHPUnit\Framework\TestCase",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\Framework\TestResult.php",\n
                      "line": 675,\n
                      "function": "runBare",\n
                      "class": "PHPUnit\Framework\TestCase",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\Framework\TestCase.php",\n
                      "line": 796,\n
                      "function": "run",\n
                      "class": "PHPUnit\Framework\TestResult",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\Framework\TestSuite.php",\n
                      "line": 746,\n
                      "function": "run",\n
                      "class": "PHPUnit\Framework\TestCase",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\Framework\TestSuite.php",\n
                      "line": 746,\n
                      "function": "run",\n
                      "class": "PHPUnit\Framework\TestSuite",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\Framework\TestSuite.php",\n
                      "line": 746,\n
                      "function": "run",\n
                      "class": "PHPUnit\Framework\TestSuite",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\TextUI\TestRunner.php",\n
                      "line": 629,\n
                      "function": "run",\n
                      "class": "PHPUnit\Framework\TestSuite",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\TextUI\Command.php",\n
                      "line": 206,\n
                      "function": "doRun",\n
                      "class": "PHPUnit\TextUI\TestRunner",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\TextUI\Command.php",\n
                      "line": 162,\n
                      "function": "run",\n
                      "class": "PHPUnit\TextUI\Command",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\phpunit",\n
                      "line": 61,\n
                      "function": "main",\n
                      "class": "PHPUnit\TextUI\Command",\n
                      "type": "::"\n
                  }\n
              ]\n
          }
          """
        #callback: null
        #encodingOptions: 192
        +headers: Symfony\Component\HttpFoundation\ResponseHeaderBag {#2115
          #computedCacheControl: array:2 [
            "no-cache" => true
            "private" => true
          ]
          #cookies: []
          #headerNames: array:5 [
            "cache-control" => "Cache-Control"
            "date" => "Date"
            "content-type" => "Content-Type"
            "x-ratelimit-limit" => "X-RateLimit-Limit"
            "x-ratelimit-remaining" => "X-RateLimit-Remaining"
          ]
          #headers: array:5 [
            "cache-control" => array:1 [
              0 => "no-cache, private"
            ]
            "date" => array:1 [
              0 => "Thu, 07 Feb 2019 10:54:26 GMT"
            ]
            "content-type" => array:1 [
              0 => "application/json"
            ]
            "x-ratelimit-limit" => array:1 [
              0 => 60
            ]
            "x-ratelimit-remaining" => array:1 [
              0 => 59
            ]
          ]
          #cacheControl: []
        }
        #content: """
          {\n
              "message": "Client error: `POST http://localhost/oauth/token` resulted in a `401 Unauthorized` response:\n{\"error\":\"invalid_client\",\"message\":\"Client authentication failed\"}\n",\n
              "exception": "GuzzleHttp\Exception\ClientException",\n
              "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php",\n
              "line": 113,\n
              "trace": [\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\guzzle\src\Middleware.php",\n
                      "line": 66,\n
                      "function": "create",\n
                      "class": "GuzzleHttp\Exception\RequestException",\n
                      "type": "::"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php",\n
                      "line": 203,\n
                      "function": "GuzzleHttp\{closure}",\n
                      "class": "GuzzleHttp\Middleware",\n
                      "type": "::"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php",\n
                      "line": 156,\n
                      "function": "callHandler",\n
                      "class": "GuzzleHttp\Promise\Promise",\n
                      "type": "::"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\TaskQueue.php",\n
                      "line": 47,\n
                      "function": "GuzzleHttp\Promise\{closure}",\n
                      "class": "GuzzleHttp\Promise\Promise",\n
                      "type": "::"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php",\n
                      "line": 246,\n
                      "function": "run",\n
                      "class": "GuzzleHttp\Promise\TaskQueue",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php",\n
                      "line": 223,\n
                      "function": "invokeWaitFn",\n
                      "class": "GuzzleHttp\Promise\Promise",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php",\n
                      "line": 267,\n
                      "function": "waitIfPending",\n
                      "class": "GuzzleHttp\Promise\Promise",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php",\n
                      "line": 225,\n
                      "function": "invokeWaitList",\n
                      "class": "GuzzleHttp\Promise\Promise",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php",\n
                      "line": 62,\n
                      "function": "waitIfPending",\n
                      "class": "GuzzleHttp\Promise\Promise",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\guzzle\src\Client.php",\n
                      "line": 131,\n
                      "function": "wait",\n
                      "class": "GuzzleHttp\Promise\Promise",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\guzzle\src\Client.php",\n
                      "line": 89,\n
                      "function": "request",\n
                      "class": "GuzzleHttp\Client",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\app\Http\Controllers\API\v1\UserController.php",\n
                      "line": 72,\n
                      "function": "__call",\n
                      "class": "GuzzleHttp\Client",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "function": "register",\n
                      "class": "App\Http\Controllers\API\v1\UserController",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Controller.php",\n
                      "line": 54,\n
                      "function": "call_user_func_array"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php",\n
                      "line": 45,\n
                      "function": "callAction",\n
                      "class": "Illuminate\Routing\Controller",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Route.php",\n
                      "line": 219,\n
                      "function": "dispatch",\n
                      "class": "Illuminate\Routing\ControllerDispatcher",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Route.php",\n
                      "line": 176,\n
                      "function": "runController",\n
                      "class": "Illuminate\Routing\Route",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Router.php",\n
                      "line": 682,\n
                      "function": "run",\n
                      "class": "Illuminate\Routing\Route",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 30,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Router",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php",\n
                      "line": 41,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 151,\n
                      "function": "handle",\n
                      "class": "Illuminate\Routing\Middleware\SubstituteBindings",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 53,\n
                      "function": "Illuminate\Pipeline\{closure}",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Middleware\ThrottleRequests.php",\n
                      "line": 58,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 151,\n
                      "function": "handle",\n
                      "class": "Illuminate\Routing\Middleware\ThrottleRequests",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 53,\n
                      "function": "Illuminate\Pipeline\{closure}",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 104,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Router.php",\n
                      "line": 684,\n
                      "function": "then",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Router.php",\n
                      "line": 659,\n
                      "function": "runRouteWithinStack",\n
                      "class": "Illuminate\Routing\Router",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Router.php",\n
                      "line": 625,\n
                      "function": "runRoute",\n
                      "class": "Illuminate\Routing\Router",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Router.php",\n
                      "line": 614,\n
                      "function": "dispatchToRoute",\n
                      "class": "Illuminate\Routing\Router",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",\n
                      "line": 176,\n
                      "function": "dispatch",\n
                      "class": "Illuminate\Routing\Router",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 30,\n
                      "function": "Illuminate\Foundation\Http\{closure}",\n
                      "class": "Illuminate\Foundation\Http\Kernel",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\fideloper\proxy\src\TrustProxies.php",\n
                      "line": 57,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 151,\n
                      "function": "handle",\n
                      "class": "Fideloper\Proxy\TrustProxies",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 53,\n
                      "function": "Illuminate\Pipeline\{closure}",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php",\n
                      "line": 31,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 151,\n
                      "function": "handle",\n
                      "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 53,\n
                      "function": "Illuminate\Pipeline\{closure}",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php",\n
                      "line": 31,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 151,\n
                      "function": "handle",\n
                      "class": "Illuminate\Foundation\Http\Middleware\TransformsRequest",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 53,\n
                      "function": "Illuminate\Pipeline\{closure}",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php",\n
                      "line": 27,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 151,\n
                      "function": "handle",\n
                      "class": "Illuminate\Foundation\Http\Middleware\ValidatePostSize",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 53,\n
                      "function": "Illuminate\Pipeline\{closure}",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php",\n
                      "line": 62,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 151,\n
                      "function": "handle",\n
                      "class": "Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php",\n
                      "line": 53,\n
                      "function": "Illuminate\Pipeline\{closure}",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php",\n
                      "line": 104,\n
                      "function": "Illuminate\Routing\{closure}",\n
                      "class": "Illuminate\Routing\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",\n
                      "line": 151,\n
                      "function": "then",\n
                      "class": "Illuminate\Pipeline\Pipeline",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php",\n
                      "line": 116,\n
                      "function": "sendRequestThroughRouter",\n
                      "class": "Illuminate\Foundation\Http\Kernel",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Testing\Concerns\MakesHttpRequests.php",\n
                      "line": 345,\n
                      "function": "handle",\n
                      "class": "Illuminate\Foundation\Http\Kernel",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\laravel\framework\src\Illuminate\Foundation\Testing\Concerns\MakesHttpRequests.php",\n
                      "line": 317,\n
                      "function": "call",\n
                      "class": "Illuminate\Foundation\Testing\TestCase",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\tests\Feature\API\UserTest.php",\n
                      "line": 52,\n
                      "function": "json",\n
                      "class": "Illuminate\Foundation\Testing\TestCase",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\Framework\TestCase.php",\n
                      "line": 1153,\n
                      "function": "a_user_can_create_user",\n
                      "class": "Tests\Feature\API\v1\UserTest",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\Framework\TestCase.php",\n
                      "line": 842,\n
                      "function": "runTest",\n
                      "class": "PHPUnit\Framework\TestCase",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\Framework\TestResult.php",\n
                      "line": 675,\n
                      "function": "runBare",\n
                      "class": "PHPUnit\Framework\TestCase",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\Framework\TestCase.php",\n
                      "line": 796,\n
                      "function": "run",\n
                      "class": "PHPUnit\Framework\TestResult",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\Framework\TestSuite.php",\n
                      "line": 746,\n
                      "function": "run",\n
                      "class": "PHPUnit\Framework\TestCase",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\Framework\TestSuite.php",\n
                      "line": 746,\n
                      "function": "run",\n
                      "class": "PHPUnit\Framework\TestSuite",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\Framework\TestSuite.php",\n
                      "line": 746,\n
                      "function": "run",\n
                      "class": "PHPUnit\Framework\TestSuite",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\TextUI\TestRunner.php",\n
                      "line": 629,\n
                      "function": "run",\n
                      "class": "PHPUnit\Framework\TestSuite",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\TextUI\Command.php",\n
                      "line": 206,\n
                      "function": "doRun",\n
                      "class": "PHPUnit\TextUI\TestRunner",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\src\TextUI\Command.php",\n
                      "line": 162,\n
                      "function": "run",\n
                      "class": "PHPUnit\TextUI\Command",\n
                      "type": "->"\n
                  },\n
                  {\n
                      "file": "C:\xampp\htdocs\iERP\ierp\vendor\phpunit\phpunit\phpunit",\n
                      "line": 61,\n
                      "function": "main",\n
                      "class": "PHPUnit\TextUI\Command",\n
                      "type": "::"\n
                  }\n
              ]\n
          }
          """
        #version: "1.1"
        #statusCode: 500
        #statusText: "Internal Server Error"
        #charset: null
        +original: array:5 [
          "message" => """
            Client error: `POST http://localhost/oauth/token` resulted in a `401 Unauthorized` response:\n
            {"error":"invalid_client","message":"Client authentication failed"}\n
            """
          "exception" => "GuzzleHttp\Exception\ClientException"
          "file" => "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php"
          "line" => 113
          "trace" => array:64 [
            0 => array:5 [
              "file" => "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\guzzle\src\Middleware.php"
              "line" => 66
              "function" => "create"
              "class" => "GuzzleHttp\Exception\RequestException"
              "type" => "::"
            ]
            1 => array:5 [
              "file" => "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php"
              "line" => 203
              "function" => "GuzzleHttp\{closure}"
              "class" => "GuzzleHttp\Middleware"
              "type" => "::"
            ]
            2 => array:5 [
              "file" => "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php"
              "line" => 156
              "function" => "callHandler"
              "class" => "GuzzleHttp\Promise\Promise"
              "type" => "::"
            ]
            3 => array:5 [
              "file" => "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\TaskQueue.php"
              "line" => 47
              "function" => "GuzzleHttp\Promise\{closure}"
              "class" => "GuzzleHttp\Promise\Promise"
              "type" => "::"
            ]
            4 => array:5 [
              "file" => "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php"
              "line" => 246
              "function" => "run"
              "class" => "GuzzleHttp\Promise\TaskQueue"
              "type" => "->"
            ]
            5 => array:5 [
              "file" => "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php"
              "line" => 223
              "function" => "invokeWaitFn"
              "class" => "GuzzleHttp\Promise\Promise"
              "type" => "->"
            ]
            6 => array:5 [
              "file" => "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php"
              "line" => 267
              "function" => "waitIfPending"
              "class" => "GuzzleHttp\Promise\Promise"
              "type" => "->"
            ]
            7 => array:5 [
              "file" => "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php"
              "line" => 225
              "function" => "invokeWaitList"
              "class" => "GuzzleHttp\Promise\Promise"
              "type" => "->"
            ]
            8 => array:5 [
              "file" => "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\promises\src\Promise.php"
              "line" => 62
              "function" => "waitIfPending"
              "class" => "GuzzleHttp\Promise\Promise"
              "type" => "->"
            ]
            9 => array:5 [
              "file" => "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\guzzle\src\Client.php"
              "line" => 131
              "function" => "wait"
              "class" => "GuzzleHttp\Promise\Promise"
              "type" => "->"
            ]
            10 => array:5 [
              "file" => "C:\xampp\htdocs\iERP\ierp\vendor\guzzlehttp\guzzle\src\Client.php"
              "line" => 89
              "function" => "request"
              "class" => "GuzzleHttp\Client"
              "type" => "->"
            ]
            11 => array:5 [
              "file" => "C:\xampp\htdocs\iERP\ierp\app\Http\Controllers\API\v1\UserController.php"
              "line" => 72
              "function" => &q
munazzil's avatar

I think you have to change this function remove first() in controller function.

$client = \DB::table('oauth_clients')->where('password_client', 1);
hardcoderrsl's avatar

@MUNAZZIL - thank you, but i doesn't work. I wrote that statement to check if client secret is same from $request and that query. and it's same. but the problem is on the next line when this statement is executed-

        $response=$http->post(url("/oauth/token"),[
            'form_params'=>[
            'grant_type'    =>'password',
              'client_id'     =>$request->client_id,
              'client_secret' =>$request->client_secret,
             'password'      =>$request->password,
             'username'      =>$request->email,
               'scope'         =>''             
                ]
         ]);

when it's executed- it somehow looks for the real database rather than my test database, I guess that end point acts like real server and thus can't authenticate the client.

hardcoderrsl's avatar

thank you everyone. it's solved now. I had to proxy the request.

hardcoderrsl's avatar
hardcoderrsl
OP
Best Answer
Level 1

sure. here is the solution- @munazzil

    $tokenRequest = Request::create('oauth/token', 'POST',$request->toArray());      // generating token 
    $response = Route::dispatch($tokenRequest);

but how do I mark as solved? can't find the option here. can you guide me?

1 like

Please or to participate in this conversation.