Thanks for the answer.
I’m now using this code:
$request = $provider->getAuthenticatedRequest(
'GET',
'https://api.twitch.tv/kraken/user',
$accessToken
);
$client = new GuzzleHttp\Client();
$response = $client->send($request);
$result = $response->getBody();
$object = json_decode($result);
print $object;
Now I’m actually getting something - an error message:
Caught exception: Client error: `GET https://api.twitch.tv/kraken/user` resulted in a `401 Unauthorized` response: {"error":"Unauthorized","status":401,"message":"authentication failed"}
It usually should mean, that either the client id or secret is wrong, but it definetly isn’t, because the example script is working perfectly fine…
Example Script
// Using the access token, get user profile
$resourceOwner = $provider->getResourceOwner($accessToken);
$user = $resourceOwner->toArray();
So, why do I get an error, even though my client id / secret is correct?