mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 16:22:42 +01:00
updating twitch to latest api (Helix)
Summary: api doc : https://dev.twitch.tv/docs/api/reference oauth2 doc : https://dev.twitch.tv/docs/authentication Test Plan: I have successfully setup OAuth2 authentication against Twitch Reviewers: O1 Blessed Committers, avivey Reviewed By: O1 Blessed Committers, avivey Subscribers: avivey, speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Tags: #auth Maniphest Tasks: T15122 Differential Revision: https://we.phorge.it/D25056
This commit is contained in:
parent
0c0b9644a6
commit
9e1bb955fa
1 changed files with 3 additions and 3 deletions
|
@ -47,12 +47,12 @@ final class PhutilTwitchFuture extends FutureProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
$uri = new PhutilURI('https://api.twitch.tv/');
|
$uri = new PhutilURI('https://api.twitch.tv/');
|
||||||
$uri->setPath('/kraken/'.ltrim($this->action, '/'));
|
$uri->setPath('/helix/'.ltrim($this->action, '/'));
|
||||||
$uri->replaceQueryParam('oauth_token', $this->accessToken);
|
|
||||||
|
|
||||||
$future = new HTTPSFuture($uri);
|
$future = new HTTPSFuture($uri);
|
||||||
$future->setData($this->params);
|
$future->setData($this->params);
|
||||||
$future->setMethod($this->method);
|
$future->setMethod($this->method);
|
||||||
|
$future->addHeader('Authorization', 'Bearer '.$this->accessToken);
|
||||||
|
|
||||||
// NOTE: This is how the Twitch API is versioned.
|
// NOTE: This is how the Twitch API is versioned.
|
||||||
$future->addHeader('Accept', 'application/vnd.twitchtv.2+json');
|
$future->addHeader('Accept', 'application/vnd.twitchtv.2+json');
|
||||||
|
@ -87,7 +87,7 @@ final class PhutilTwitchFuture extends FutureProxy {
|
||||||
throw new Exception(pht('Received error from Twitch: %s', $error));
|
throw new Exception(pht('Received error from Twitch: %s', $error));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data['data'][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue