Skip to content

Commit c6dbde3

Browse files
authored
Merge pull request #11 from RaiolaNetworks/develop
feat: added a check if the OAuth information exists in the renew func…
2 parents 5433f50 + 7d9a9a6 commit c6dbde3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Controllers/OAuthController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ public function renew(): null|\Illuminate\Routing\Redirector|RedirectResponse
133133

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

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

0 commit comments

Comments
 (0)