Hi all developers,

I’m using Basic Usage - OAuth 2.0 Client to login me with Twitter to my website, and I want to use getAuthenticateRequest() method to get users/me data from https://api.twitter.com/2/users/me endpoint.

$request = $provider->getAuthenticatedRequest(
    'GET',
    'https://api.twitter.com/2/users/me',
    'QlZYMm...mF0OjE' // still valid access_token
);

The problem is the body I get is empty but not on Postman.

var_dump($request->getBody()->getContents());

I use Postman in parallel which works wonderfully well when I type on the endpoint.

I’m probably missing a header to send during my request with Authorization (Bearer <access_token>) and Host, but I don’t know which one.

Thanks to help me please.

Max.

My bad…

I must use $parsed = $provider->getParsedResponse($request); to parse the request response :slight_smile:

Thanks.

Max.

2 Likes

Glad you got this working!