UI: Add two-factor authentication warning for Twitch
Twitch will now return a 403 HTTP error code if you attempt to query your stream key when your Twitch account does not have two-factor authentication enabled. This handles it a bit better and displays an appropriate error message for users so they know where to go to enable it.
This commit is contained in:
parent
3bd99797d9
commit
6272409c49
@ -78,6 +78,7 @@ try {
|
||||
|
||||
std::string output;
|
||||
std::string error;
|
||||
long error_code = 0;
|
||||
|
||||
bool success = false;
|
||||
|
||||
@ -86,7 +87,7 @@ try {
|
||||
"https://api.twitch.tv/kraken/channel",
|
||||
output,
|
||||
error,
|
||||
nullptr,
|
||||
&error_code,
|
||||
"application/json",
|
||||
nullptr,
|
||||
headers,
|
||||
@ -98,6 +99,19 @@ try {
|
||||
func,
|
||||
QTStr("Auth.LoadingChannel.Title"),
|
||||
QTStr("Auth.LoadingChannel.Text").arg(service()));
|
||||
if (error_code == 403) {
|
||||
OBSMessageBox::warning(OBSBasic::Get(),
|
||||
Str("TwitchAuth.TwoFactorFail.Title"),
|
||||
Str("TwitchAuth.TwoFactorFail.Text"),
|
||||
true);
|
||||
blog(LOG_WARNING, "%s: %s",
|
||||
__FUNCTION__,
|
||||
"Got 403 from Twitch, user probably does not "
|
||||
"have two-factor authentication enabled on "
|
||||
"their account");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!success || output.empty())
|
||||
throw ErrorInfo("Failed to get text from remote", error);
|
||||
|
||||
|
@ -113,6 +113,8 @@ Auth.Chat="Chat"
|
||||
Auth.StreamInfo="Stream Information"
|
||||
TwitchAuth.Stats="Twitch Stats"
|
||||
TwitchAuth.Feed="Twitch Activity Feed"
|
||||
TwitchAuth.TwoFactorFail.Title="Could not query stream key"
|
||||
TwitchAuth.TwoFactorFail.Text="Stream key request forbidden.<br><br>Note that Twitch now requires <a href='https://passport.twitch.tv/register_2fa/new'>two-factor authentication</a> in order to stream."
|
||||
|
||||
# copy filters
|
||||
Copy.Filters="Copy Filters"
|
||||
|
Loading…
x
Reference in New Issue
Block a user