Skip to content

Commit 40d12f7

Browse files
committed
UI: Invalidate Twitch token when disconnecting
1 parent 1377fdf commit 40d12f7

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

UI/auth-twitch.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ using namespace json11;
2424

2525
#define TWITCH_AUTH_URL OAUTH_BASE_URL "v1/twitch/redirect"
2626
#define TWITCH_TOKEN_URL OAUTH_BASE_URL "v1/twitch/token"
27+
#define TWITCH_REOKVE_URL "https://id.twitch.tv/oauth2/revoke"
2728

2829
#define TWITCH_SCOPE_VERSION 1
2930

@@ -499,6 +500,15 @@ std::shared_ptr<Auth> TwitchAuth::Login(QWidget *parent, const std::string &)
499500
return nullptr;
500501
}
501502

503+
void TwitchAuth::DeleteInternal()
504+
{
505+
std::string client_id = TWITCH_CLIENTID;
506+
deobfuscate_str(&client_id[0], TWITCH_HASH);
507+
508+
InvalidateToken(TWITCH_REOKVE_URL, client_id);
509+
OAuthStreamKey::DeleteInternal();
510+
}
511+
502512
static std::shared_ptr<Auth> CreateTwitchAuth()
503513
{
504514
return std::make_shared<TwitchAuth>(twitchDef);

UI/auth-twitch.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class TwitchAuth : public OAuthStreamKey {
2424

2525
virtual void SaveInternal() override;
2626
virtual bool LoadInternal() override;
27+
virtual void DeleteInternal() override;
2728

2829
bool MakeApiRequest(const char *path, json11::Json &json_out);
2930
bool GetChannelInfo();

0 commit comments

Comments
 (0)