Skip to content

Commit

Permalink
chore: log warning on failed token refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
Yizack committed Jul 22, 2024
1 parent 54a41e9 commit e583e7f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/InstagramFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ protected function refreshToken() {
$updatedDate = $updatedJson["updated"] ?? $date;

if (strtotime($date) - strtotime($updatedDate) > self::TOKEN_REFRESH_INTERVAL) {
$this->fetch("https://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&access_token=" . $this->getToken());
$refresh = $this->fetch("https://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&access_token=" . $this->getToken());
if (!$refresh) {
error_log("Warning: Failed to refresh token, please check your configuration or generate a new token.");
}
file_put_contents($filePath, json_encode($array));
}
}
Expand Down

0 comments on commit e583e7f

Please sign in to comment.