diff --git a/extend.php b/extend.php index 46191ad..dde8517 100644 --- a/extend.php +++ b/extend.php @@ -73,7 +73,10 @@ (new Extend\ApiSerializer(CurrentUserSerializer::class)) ->attributes(function (CurrentUserSerializer $serializer, User $user, array $attributes) { $session = $serializer->getRequest()->getAttribute('session'); - $attributes['loginProvider'] = $session?->get(AbstractOAuthController::SESSION_OAUTH2PROVIDER); + + if ($session) { + $attributes['loginProvider'] = $session->get(AbstractOAuthController::SESSION_OAUTH2PROVIDER); + } return $attributes; }),