Skip to content

Commit f16036c

Browse files
Fixes decryption of refresh token.
1 parent a387625 commit f16036c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/elgato-cloud-data.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ void ElgatoCloud::_TokenRefresh(bool loadData, bool loadUserDetails)
136136
}
137137
return;
138138
}
139+
obs_log(LOG_INFO, "Access Token has expired. Fetching a new token.");
139140
auto api = MarketplaceApi::getInstance();
140141
std::string encodeddata;
141142
encodeddata += "grant_type=refresh_token";
@@ -149,6 +150,7 @@ void ElgatoCloud::_TokenRefresh(bool loadData, bool loadUserDetails)
149150
auto responseJson = nlohmann::json::parse(response);
150151
_ProcessLogin(responseJson, loadData);
151152
} catch (...) {
153+
obs_log(LOG_INFO, "There was a problem with the refresh token. Try logging in again.");
152154
loggedIn = false;
153155
loading = false;
154156
authorizing = false;
@@ -523,12 +525,14 @@ void ElgatoCloud::_GetSavedState()
523525
std::string refreshTokenEncrypted = obs_data_get_string(_config, "RefreshToken");
524526
if (accessTokenEncrypted.size() > 25) {
525527
_accessToken = decryptString(accessTokenEncrypted);
528+
_accessToken = _accessToken.substr(0, _accessToken.length() - 1);
526529
} else {
527530
_accessToken = "";
528531
}
529532

530533
if (refreshTokenEncrypted.size() > 25) {
531534
_refreshToken = decryptString(refreshTokenEncrypted);
535+
_refreshToken = _refreshToken.substr(0, _refreshToken.length() - 1);
532536
} else {
533537
_refreshToken = "";
534538
}

0 commit comments

Comments
 (0)