aboutsummaryrefslogtreecommitdiff
path: root/src/graphql
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphql')
-rw-r--r--src/graphql/user/resolvers.ts10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/graphql/user/resolvers.ts b/src/graphql/user/resolvers.ts
index 986b9684..dfbaa927 100644
--- a/src/graphql/user/resolvers.ts
+++ b/src/graphql/user/resolvers.ts
@@ -24,6 +24,7 @@ import {
type UserPreferences,
} from "$lib/Database/SB/User/preferences";
import privilegedUser from "$lib/Utility/privilegedUser";
+import { decodeAuthCookieOrThrow } from "$lib/Effect/authCookie";
type Context = RequestEvent<Partial<Record<string, string>>, string | null>;
type UserResolvers = Pick<
@@ -51,14 +52,9 @@ const auth = async (context: Context) => {
if (!userCookie) return Error("Unauthorised");
- const user = JSON.parse(userCookie);
+ const user = decodeAuthCookieOrThrow(userCookie);
- return await userIdentity({
- tokenType: user["token_type"],
- expiresIn: user["expires_in"],
- accessToken: user["access_token"],
- refreshToken: user["refresh_token"],
- });
+ return await userIdentity(user);
};
const authenticatedBadgesOperation = async (