mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
add twitch getAuthorized method which passes through a custom client ID and oauth token
This commit is contained in:
parent
ec63bc59be
commit
3f6881390e
1 changed files with 14 additions and 0 deletions
|
@ -50,6 +50,20 @@ static void get(QString url, const QObject *caller,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void getAuthorized(QString url, const QString &clientID, const QString &oauthToken,
|
||||||
|
const QObject *caller, std::function<void(QJsonObject &)> successCallback)
|
||||||
|
{
|
||||||
|
util::NetworkRequest req(url);
|
||||||
|
req.setCaller(caller);
|
||||||
|
req.setRawHeader("Client-ID", clientID.toUtf8());
|
||||||
|
req.setRawHeader("Authorization", "OAuth " + oauthToken.toUtf8());
|
||||||
|
req.setRawHeader("Accept", "application/vnd.twitchtv.v5+json");
|
||||||
|
req.get([=](QNetworkReply *reply) {
|
||||||
|
auto node = parseJSONFromReply(reply);
|
||||||
|
successCallback(node);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
static void getUserID(QString username, const QObject *caller,
|
static void getUserID(QString username, const QObject *caller,
|
||||||
std::function<void(QString)> successCallback)
|
std::function<void(QString)> successCallback)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue