I'm using a post request, this is the code
//API routes Route::post('getToken', '[email protected]'); //getToken Method $client = new Client(); $params = [ // 'client_id' => env('4GEEKS_CLIENT_ID'), // 'client_secret' => env('4GEEKS_CLIENT_SECRET'), ]; $headers = [ 'grant_type' => 'client_credentials', 'client_id' => env('4GEEKS_CLIENT_ID'), 'client_secret' => env('4GEEKS_CLIENT_SECRET'), ]; $response = $client->request('POST', 'https://api.payments.4geeks.io/authentication/token', [ 'json' => $params, 'headers' => $headers ]); return $response->getBody();
4Geeks Payments uses oAuth2 so be sure to send grant_type=client_credentials. Also you must send client_id=<4geeks-payments-client-id>, client_secret=<4geeks-payments-client-secret>. This will return an access_token, which will need to be sent in every other request going forware. Remember to never have these credentials visible to anyone, never upload them to repositories like GitHub and never share them. It's recommended to use these credential in environment variables.
I'm not sure where to send the
client_secret, in the headers or params.
I did try running
composer dumpautoload and
php artisan route:cache but I'm still getting that error. What can I do to fix it?