diff --git a/UI/auth-restream.cpp b/UI/auth-restream.cpp index 9188da118c9684..e797bb98f1d791 100644 --- a/UI/auth-restream.cpp +++ b/UI/auth-restream.cpp @@ -21,6 +21,7 @@ using namespace json11; #define RESTREAM_AUTH_URL OAUTH_BASE_URL "v1/restream/redirect" #define RESTREAM_TOKEN_URL OAUTH_BASE_URL "v1/restream/token" +#define RESTREAM_REVOKE_URL "https://api.restream.io/oauth/revoke" #define RESTREAM_STREAMKEY_URL "https://api.restream.io/v2/user/streamKey" #define RESTREAM_SCOPE_VERSION 1 @@ -129,6 +130,12 @@ bool RestreamAuth::LoadInternal() return OAuthStreamKey::LoadInternal(); } +void RestreamAuth::DeleteInternal() +{ + InvalidateToken(RESTREAM_REVOKE_URL, ""); + OAuthStreamKey::DeleteInternal(); +} + void RestreamAuth::LoadUI() { if (uiLoaded) diff --git a/UI/auth-restream.hpp b/UI/auth-restream.hpp index 334906c42f7a5e..459b6159f4f484 100644 --- a/UI/auth-restream.hpp +++ b/UI/auth-restream.hpp @@ -13,6 +13,7 @@ class RestreamAuth : public OAuthStreamKey { virtual void SaveInternal() override; virtual bool LoadInternal() override; + virtual void DeleteInternal() override; bool GetChannelInfo(); diff --git a/UI/auth-twitch.cpp b/UI/auth-twitch.cpp index 386a0e9275cc9a..f9ab41ef6dbdc0 100644 --- a/UI/auth-twitch.cpp +++ b/UI/auth-twitch.cpp @@ -24,6 +24,7 @@ using namespace json11; #define TWITCH_AUTH_URL OAUTH_BASE_URL "v1/twitch/redirect" #define TWITCH_TOKEN_URL OAUTH_BASE_URL "v1/twitch/token" +#define TWITCH_REOKVE_URL "https://id.twitch.tv/oauth2/revoke" #define TWITCH_SCOPE_VERSION 1 @@ -499,6 +500,15 @@ std::shared_ptr TwitchAuth::Login(QWidget *parent, const std::string &) return nullptr; } +void TwitchAuth::DeleteInternal() +{ + std::string client_id = TWITCH_CLIENTID; + deobfuscate_str(&client_id[0], TWITCH_HASH); + + InvalidateToken(TWITCH_REOKVE_URL, client_id); + OAuthStreamKey::DeleteInternal(); +} + static std::shared_ptr CreateTwitchAuth() { return std::make_shared(twitchDef); diff --git a/UI/auth-twitch.hpp b/UI/auth-twitch.hpp index 152b2a95730fd7..6ee781f8aefff7 100644 --- a/UI/auth-twitch.hpp +++ b/UI/auth-twitch.hpp @@ -24,6 +24,7 @@ class TwitchAuth : public OAuthStreamKey { virtual void SaveInternal() override; virtual bool LoadInternal() override; + virtual void DeleteInternal() override; bool MakeApiRequest(const char *path, json11::Json &json_out); bool GetChannelInfo(); diff --git a/UI/auth-youtube.cpp b/UI/auth-youtube.cpp index f2f3ca4e8e69d7..b3e888265046b2 100644 --- a/UI/auth-youtube.cpp +++ b/UI/auth-youtube.cpp @@ -33,6 +33,7 @@ using namespace json11; /* ------------------------------------------------------------------------- */ #define YOUTUBE_AUTH_URL "https://accounts.google.com/o/oauth2/v2/auth" #define YOUTUBE_TOKEN_URL "https://www.googleapis.com/oauth2/v4/token" +#define YOUTUBE_REVOKE_URL "https://oauth2.googleapis.com/revoke" #define YOUTUBE_SCOPE_VERSION 1 #define YOUTUBE_API_STATE_LENGTH 32 #define SECTION_NAME "YouTube" @@ -188,6 +189,12 @@ bool YoutubeAuth::LoadInternal() return implicit ? !token.empty() : !refresh_token.empty(); } +void YoutubeAuth::DeleteInternal() +{ + InvalidateToken(YOUTUBE_REVOKE_URL); + OAuthStreamKey::DeleteInternal(); +} + #ifdef BROWSER_AVAILABLE static const char *ytchat_script = "\ const obsCSS = document.createElement('style');\ diff --git a/UI/auth-youtube.hpp b/UI/auth-youtube.hpp index ffe35c25c39c09..cbf8a812ed7193 100644 --- a/UI/auth-youtube.hpp +++ b/UI/auth-youtube.hpp @@ -49,6 +49,7 @@ class YoutubeAuth : public OAuthStreamKey { virtual bool RetryLogin() override; virtual void SaveInternal() override; virtual bool LoadInternal() override; + virtual void DeleteInternal() override; virtual void LoadUI() override; QString GenerateState();