I got the a token but I still got the same error message.
Generate Token:
public function createAppAccessToken($type = 'client_credentials'){
// requet endpoint
$endpoint = self::TWITCH_ID_DOMAIN . 'oauth2/token';
$apiParams = array( // params for our api call
'endpoint' => $endpoint,
'type' => 'POST',
'url_params' => array(
'client_id' => $this->_clientId,
'client_secret' => $this->_clientSecret,
'scope' => 'channel:read:editors channel:read:stream_key user:edit:broadcast user:read:email user:read:subscriptions chat:read channel:read:subscriptions',
'grant_type' => $type ,
)
);
return $this->makeApiCall( $apiParams );
}
Get User:
function getUserId($users, $id){
if($users == null){
$endpoint = self::TWITCH_API_DOMAIN. "users?id=".$id;
}else{
$endpoint = self::TWITCH_API_DOMAIN. "users?login=".$users;
}
$header = array( // temp hardcoded header
'Client-Id: ' . $this->_clientId,
'Authorization: Bearer '. $this->_accessToken,
);
$apiParams = array(
'endpoint' => $endpoint,
'type' => 'GET',
'Authorization' => $header,
'url_params' => array()
);
return $this->makeApiCall($apiParams);
}
getUserId function worked with kraken and now I added the header for the Helix api but it doesnt work.
I just need the userinfo without the mail