I'm trying to query the passport /oauth/clients endpoint from my backend php and I am using this code
$response = Http::get(config('app.url') .'/oauth/clients');
where my app.url is set to http://homestead.test (for development purposes). If I navigate to that endpoint in my browser I get an array of clients as expected but as soon as I try to do this query from my backend and then dump the body like this dd($response->body()); it just returns my website login page.
I'm assuming this is due to the session not being passed correctly as a header but if I dump $response->headers() I get a Set-Cookie header with my app session there.
I am currently using this code to get the clients array and it works, but I think it isn't the best way to get the array as it messes up the Route
$clientRequest = Request::create(config('app.url') .'/oauth/clients');
$response = Route::dispatch($clientRequest);
$clients = json_decode($response->getContent(), true);