Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
RhysLees committed Feb 18, 2025
1 parent a94f38b commit 91ecf58
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Authenticator/InstagramAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public function getExpiresAt(): ?DateTimeImmutable
*/
public function isRefreshable(): bool
{
Carbon::createFromTimestamp($this->getExpiresAt()->getTimestamp())->diffInDays();
$created = Carbon::createFromTimestamp($this->getExpiresAt()->getTimestamp())->subDays(60);

return now()->subHours(24)->gt($this->getExpiresAt());
return now()->diffInHours($created) > 24;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(protected string $code) {}
public function defaultQuery(): array
{
return [
'grant_type' => 'ig_exchange_token',
'grant_type' => 'ig_refresh_token',
'access_token' => $this->code,
];
}
Expand Down
3 changes: 1 addition & 2 deletions src/Traits/AuthorizationCodeGrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ protected function createOAuthAuthenticatorFromResponse(Response $response, ?str
$responseData = $response->object();

$accessToken = $responseData->access_token;
$refreshToken = $responseData->refresh_token ?? $fallbackRefreshToken;

$expiresAt = null;

Expand All @@ -196,7 +195,7 @@ protected function createOAuthAuthenticatorFromResponse(Response $response, ?str
);
}

return $this->createOAuthAuthenticator($accessToken, $refreshToken, $expiresAt);
return $this->createOAuthAuthenticator($accessToken, null, $expiresAt);
}

/**
Expand Down

0 comments on commit 91ecf58

Please sign in to comment.