1
0
mirror of https://github.com/beestat/app.git synced 2025-05-24 02:14:03 -04:00

Fixed #154 - Patreon tokens are not refreshing properly

For real this time
This commit is contained in:
Jon Ziebell 2019-08-28 21:24:53 -04:00
parent 82563f3a55
commit 22671bb7b5

View File

@ -122,7 +122,7 @@ class patreon extends external_api {
// If the token was expired, refresh it and try again. Trying again sets
// auto_refresh_token to false to prevent accidental infinite refreshing if
// something bad happens.
if (isset($response['errors']) === true && $response['status'] === '401') {
if (isset($response['errors']) === true && $response['errors'][0]['status'] === '401') {
// Authentication token has expired. Refresh your tokens.
if ($auto_refresh_token === true) {
$this->api('patreon_token', 'refresh');
@ -132,7 +132,7 @@ class patreon extends external_api {
if($this::$log_mysql !== 'all') {
$this->log_mysql($curl_response);
}
throw new Exception($response['status']['message']);
throw new Exception($response['errors'][0]['detail']);
}
}
else if (isset($response['errors']) === true) {
@ -140,7 +140,7 @@ class patreon extends external_api {
if($this::$log_mysql !== 'all') {
$this->log_mysql($curl_response);
}
throw new Exception($response['status']['message']);
throw new Exception($response['errors'][0]['detail']);
}
else {
return $response;