1 year ago

GuzzleHttp Doesn't Response

Posted 1 year ago by mecjos

Hi everyone. For two days, I have been tyring to take oauth token by makin guzzlehttp request. But guzzle request doesn't response. It waits for response then exceeds execution time. I installed guzzlehttp, enabled allow_url_fopen and curl in php.ini file. What can be the problem with guzzel. I'm trying to take token by using postman and here is my controller

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use GuzzleHttp;

class AuthController extends Controller {
        public function login (Request $request) {
            $http = new GuzzleHttp\Client;
            $response = $http->request('post', '', [
                'form_params' => [
                'grant_type' => 'password',
                'client_id' => 2,
            'client_secret' => 'XAjhpNmcpcAA7DnboSQp7GEiE0vFk4E4qPGt5eDr',
            'username' => $request->username,
            'password' => $request->password,
            'scope' => '',
    return json_decode((string) $response->getBody(), true);


Please sign in or create an account to participate in this conversation.