From bb1939b8343058e3e63625bb44441324dd2cd009 Mon Sep 17 00:00:00 2001 From: benjdlambert Date: Tue, 8 Jul 2025 10:52:32 +0200 Subject: [PATCH] chore: issue token first before saving userInfo Signed-off-by: benjdlambert --- .../src/lib/resolvers/CatalogAuthResolverContext.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/auth-backend/src/lib/resolvers/CatalogAuthResolverContext.ts b/plugins/auth-backend/src/lib/resolvers/CatalogAuthResolverContext.ts index eec5593f81..269c7131dc 100644 --- a/plugins/auth-backend/src/lib/resolvers/CatalogAuthResolverContext.ts +++ b/plugins/auth-backend/src/lib/resolvers/CatalogAuthResolverContext.ts @@ -88,15 +88,17 @@ export class CatalogAuthResolverContext implements AuthResolverContext { ...additionalClaims, }; + const issuedToken = await this.tokenIssuer.issueToken({ + claims, + }); + // Store the user info in the database upon successful token // issuance so that it can be retrieved later by limited user tokens await this.userInfo.addUserInfo({ claims, }); - return await this.tokenIssuer.issueToken({ - claims, - }); + return issuedToken; } async findCatalogUser(query: AuthResolverCatalogUserQuery) {