浏览代码

UI: If Twitch account disconnected, retry login

If the user disconnects OBS from their Twitch account on their Twitch
settings panel, then try asking the user if they'd like to reconnect
before throwing an error.
jp9000 6 年之前
父节点
当前提交
9ffe7f5f94
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      UI/auth-twitch.cpp

+ 9 - 1
UI/auth-twitch.cpp

@@ -102,8 +102,16 @@ try {
 		throw ErrorInfo("Failed to parse json", error);
 
 	error = json["error"].string_value();
-	if (!error.empty())
+	if (!error.empty()) {
+		if (error == "Unauthorized") {
+			if (RetryLogin()) {
+				return GetChannelInfo();
+			}
+			throw ErrorInfo(error,
+					json["message"].string_value());
+		}
 		throw ErrorInfo(error, json["error_description"].string_value());
+	}
 
 	name = json["name"].string_value();
 	key_ = json["stream_key"].string_value();