Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Albyzai's avatar

Guzzle Post request returning 'Unauthorized' PP OAuth2

Hey,

I am following the Laravel 5.7 Documentation for OAuth2 implementation, but i'm getting the following error when making a most request with GuzzleClient:

Client error: POST http://rankup.dinmor/oauth/token resulted in a 401 Unauthorized response: {"error":"invalid_credentials","message":"The user credentials were incorrect."}

I am hosting my laravel app on xampp.

    $http = new Client();

    $response = $http->post('http://rankup.dinmor/oauth/token', [
      'form_params' => [
        'grant_type' => 'password',
        'client_id' => '2',
        'client_secret' => '5n053udMlMksA1AyVmLUxoxTVr2Algnm4aTRjkQk',
        'username' => $request->email,
        'password' => $request->password,
        'scope' => '',
      ],
    ]);

    return json_decode((string) $response->getBody(), true);

Does anyone have experience with this? I've googled a bit around and seen other people with the same issue, but haven't really found a working solution.

0 likes
0 replies

Please or to participate in this conversation.