I created a basic laravel passport authentication and created callback and redirect to authorize user below is my code
Route::get('/redirect', function () {
$query = http_build_query([
'client_id' => 4,
'redirect_uri' => 'http://localhost:8000/callback',
'response_type' => 'code',
'scope' => '',
]);
return redirect('http://localhost:8000/oauth/authorize?'.$query);
});
Route::get('/callback', function (Request $request) {
$http = new GuzzleHttp\Client;
$response = $http->post('http://localhost:8000/oauth/token', [
'form_params' => [
'grant_type' => 'authorization_code',
'client_id' => 4,
'client_secret' => 'MUqUFrtAx3ix84zFTxwqQXA5PQDY7SWwVFW9tCNX',
'redirect_uri' => 'http://localhost:8000/callback',
'code' => $request->code,
],
]);
return json_decode((string) $response->getBody(), true);
});
I followed the steps provided on https://laravel.com/docs/5.4/passport but when i click on authorize button the page keeps loading without any response and i have to restart artisan serve
. What could be the possible issue?