Hello!
I am using the authentication example from github:
https://github.com/twitchdev/authentication-samples/tree/master/php
The example works, but when trying to create a custom authenticated API request…
// You can now create authenticated API requests through the provider.
$request = $provider->getAuthenticatedRequest(
'GET',
'https://api.twitch.tv/kraken/user',
$accessToken
);
… but var_export($request);
returns something weird like this…
Output
GuzzleHttp\Psr7\Request::__set_state(array(
'method' => 'GET',
'requestTarget' => NULL,
'uri' =>
GuzzleHttp\Psr7\Uri::__set_state(array(
'scheme' => 'https',
'userInfo' => '',
'host' => 'api.twitch.tv',
'port' => NULL,
'path' => '/kraken/user',
'query' => '',
'fragment' => '',
)),
'headers' =>
array (
'Host' =>
array (
0 => 'api.twitch.tv',
),
'Client-ID' =>
array (
0 => '<Removed>',
),
'Accept' =>
array (
0 => 'application/vnd.twitchtv.v5+json',
),
'Authorization' =>
array (
0 => 'Bearer <Removed>',
),
),
'headerNames' =>
array (
'client-id' => 'Client-ID',
'accept' => 'Accept',
'authorization' => 'Authorization',
'host' => 'Host',
),
'protocol' => '1.1',
'stream' => NULL,
))
…and not something like this, which I was hoping to get:
Array
(
[data] => Array
(
[0] => Array
(
[id] => 130710009
[login] => cr4zyeasy
[display_name] => Cr4zyEasy
[type] =>
[broadcaster_type] =>
[description] =>
[profile_image_url] => https://static-cdn.jtvnw.net/jtv_user_pictures/cr4zyeasy-profile_image-a5d32b6de722b4d6-300x300.png
[offline_image_url] =>
[view_count] => 32
)
)
)
(I don’t want to do this request, it was just an example to simplify my problem)
What am I doing wrong?
Thanks in advance!