I have successfully created server.app and client.app using Laravel Passport documentation. Everything works as expected.<
According to Laravel documentation, you should add route to server app (routes/api.php): $response->getBody();
Route::get('/user', function () {
// authenticated user. Use User::find() to get the user from db by id
return app()->request()->user();
})->middleware('auth:api');
Make request via quzzle:
$response = $client->request('GET', '/api/user', [
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer '.$accessToken,
],
]);
echo $response->getBody();