I've created a new laravel 5.3 project and set it up from this tutorial : http://ift.tt/2akuQCy
but when I try to check the oauth server by sending restful request from http request add-on in firefox I get Not Found - 404
my request url : http://localhost/pcheck/user And I have set header : "Application/json"
My web.php Route file :
// First route that user visits on consumer app Route::get('/redirect', function () { // Build the query parameter string to pass auth information to our request $query = http_build_query([ 'client_id' => 3, 'redirect_uri' => 'http://localhost/pcheck/callback', 'response_type' => 'code', 'scope' => 'conference' ]);
// Redirect the user to the OAuth authorization page
return redirect('http://localhost/pcheck/oauth/authorize?' . $query);
});
// Route that user is forwarded back to after approving on server Route::get('/callback', function (Request $request) { $http = new GuzzleHttp\Client;
$response = $http->post('http://localhost/pcheck/oauth/token', [
'form_params' => [
'grant_type' => 'authorization_code',
'client_id' => '3',
'client_secret' => 'azWM7CGS4UtIQ30sd5bwW5s53P52QjaRmUdWjKpx',
'redirect_uri' => 'http://localhost/pcheck/callback',
'code' => $request->code,
],
]);
return json_decode((string) $response->getBody(), true);
});
My api.php Route file :
Route::get('/user', function (Request $request) { return $request->user(); })->middleware('auth:api');
I don't know where I'm wrong any idea ?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire