From 23dcd318f3d7ab431d368a2915e91ec0cdd12dce Mon Sep 17 00:00:00 2001
From: Seth Battis <sbattis@groton.org>
Date: Tue, 23 Apr 2024 17:55:53 -0700
Subject: [PATCH] Oy

---
 packages/appengine-client/src/GoogleSecretsToken.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/packages/appengine-client/src/GoogleSecretsToken.php b/packages/appengine-client/src/GoogleSecretsToken.php
index 927bc865..cd2003b7 100644
--- a/packages/appengine-client/src/GoogleSecretsToken.php
+++ b/packages/appengine-client/src/GoogleSecretsToken.php
@@ -4,6 +4,7 @@
 
 use Battis\LazySecrets\Cache;
 use Battis\OpenAPI\Client\TokenStorage;
+use League\OAuth2\Client\Token\AccessToken;
 use League\OAuth2\Client\Token\AccessTokenInterface;
 
 class GoogleSecretsToken extends TokenStorage
@@ -25,7 +26,11 @@ public function __construct(mixed $projectId)
 
     public function getToken(): ?AccessTokenInterface
     {
-        return $this->secrets->get(self::ACCESS_TOKEN);
+        $result = $this->secrets->get(self::ACCESS_TOKEN);
+        if ($result != null) {
+            return new AccessToken($result);
+        }
+        return null;
     }
 
     public function setToken(AccessTokenInterface $token): bool