Skip to content

Commit

Permalink
Merge pull request #11 from RaiolaNetworks/develop
Browse files Browse the repository at this point in the history
feat: added a check if the OAuth information exists in the renew func…
  • Loading branch information
victore13 authored Oct 2, 2024
2 parents 5433f50 + 7d9a9a6 commit c6dbde3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Controllers/OAuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ public function renew(): null|\Illuminate\Routing\Redirector|RedirectResponse

if (Auth::guard($guardName)->check()) {
$user = Auth::guard($guardName)->user();
$oauthData = OAuth::whereUserId($user?->getAuthIdentifier())->firstOrFail();
$oauthData = OAuth::whereUserId($user?->getAuthIdentifier())->first();

// @phpstan-ignore-next-line
if ($oauthData->oauth_token !== null && $oauthData->oauth_token_expires_at < now()->timestamp) {
if ($oauthData !== null && $oauthData->oauth_token !== null && $oauthData->oauth_token_expires_at < now()->timestamp) {
if (config('oauth.offline_access') === false) {
return $this->unauthorizeAndLogout($oauthData, $guardName);
}
Expand Down

0 comments on commit c6dbde3

Please sign in to comment.