Postingan lainnya
cURL error 60: SSL certificate problem: unable to get local issuer certificate
saya sedang membuat oauth server menggunakan laravel versi 7.27 dan laravel passport versi 9.3
dan saya menggunakan laragon
ketika saya telah menyetejui authorization kemudian akan di redirect ke halaman callback.
kemudian saya ingin menukar code menjadi access token namun muncul error seperti ini "Error cURL error 60: SSL certificate problem: unable to get local issuer certificate"
gambar errornya:
Screenshot 2020-09-08 104911.png
berikut codenya:
Route untuk authorize:
Route::get('/redirect', function (Request $request) {
$request->session()->put('state', $state = Str::random(40));
$query = http_build_query([
'client_id' => '917a17f8-f127-4f9d-a233-145e11951dfe',
'redirect_uri' => 'https://oauth2.me/callback',
'response_type' => 'code',
'scope' => '',
'state' => $state
]);
return redirect('https://oauth2.me/oauth/authorize?' . $query);
})->middleware('verified');
Route untuk /callback
Route::get('/callback', function (Request $request) {
$state = $request->session()->pull('state');
throw_unless(
strlen($state) > 0 && $state === $request->state,
InvalidArgumentException::class
);
$http = new GuzzleHttp\Client;
$response = $http->post('https://oauth2.me/oauth/token', [
'form_params' => [
'grant_type' => 'authorization_code',
'client_id' => '917a17f8-f127-4f9d-a233-145e11951dfe',
'client_secret' => '0n3MwcLUq8nEngIePnafvguUWiuhAr6X5L1csfI3',
'redirect_uri' => 'https://oauth2.me/callback',
'code' => $request->code,
],
]);
return json_decode((string) $response->getBody(), true);
})->middleware('verified');
terima kasih....
0
Belum ada Jawaban. Jadi yang pertama Jawaban
Login untuk ikut Jawaban