From 650db61be681e0898baa8090803b31fbe6917be3 Mon Sep 17 00:00:00 2001 From: Nemi Shah Date: Thu, 7 Sep 2023 12:48:19 +0530 Subject: [PATCH] Refactor signature of validateAccessToken --- lib/build/recipe/thirdparty/providers/custom.js | 2 +- lib/build/recipe/thirdparty/types.d.ts | 4 +--- lib/ts/recipe/thirdparty/providers/custom.ts | 2 +- lib/ts/recipe/thirdparty/types.ts | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/build/recipe/thirdparty/providers/custom.js b/lib/build/recipe/thirdparty/providers/custom.js index 05f58e611..00bd49278 100644 --- a/lib/build/recipe/thirdparty/providers/custom.js +++ b/lib/build/recipe/thirdparty/providers/custom.js @@ -354,7 +354,7 @@ function NewProvider(input) { */ if (impl.config.validateAccessToken !== undefined) { yield impl.config.validateAccessToken({ - accessTokenPayload: rawUserInfoFromProvider.fromUserInfoAPI, + accessToken: accessToken, clientConfig: impl.config, userContext, }); diff --git a/lib/build/recipe/thirdparty/types.d.ts b/lib/build/recipe/thirdparty/types.d.ts index a5b666382..fd51d8d07 100644 --- a/lib/build/recipe/thirdparty/types.d.ts +++ b/lib/build/recipe/thirdparty/types.d.ts @@ -80,9 +80,7 @@ declare type CommonProviderConfig = { * @param input.userContext Refer to https://supertokens.com/docs/thirdparty/advanced-customizations/user-context */ validateAccessToken?: (input: { - accessTokenPayload: { - [key: string]: any; - }; + accessToken: string; clientConfig: ProviderConfigForClientType; userContext: any; }) => Promise; diff --git a/lib/ts/recipe/thirdparty/providers/custom.ts b/lib/ts/recipe/thirdparty/providers/custom.ts index 6b5fc9531..b6e2ff849 100644 --- a/lib/ts/recipe/thirdparty/providers/custom.ts +++ b/lib/ts/recipe/thirdparty/providers/custom.ts @@ -342,7 +342,7 @@ export default function NewProvider(input: ProviderInput): TypeProvider { */ if (impl.config.validateAccessToken !== undefined) { await impl.config.validateAccessToken({ - accessTokenPayload: rawUserInfoFromProvider.fromUserInfoAPI, + accessToken: accessToken, clientConfig: impl.config, userContext, }); diff --git a/lib/ts/recipe/thirdparty/types.ts b/lib/ts/recipe/thirdparty/types.ts index 30a659fec..750d44d3d 100644 --- a/lib/ts/recipe/thirdparty/types.ts +++ b/lib/ts/recipe/thirdparty/types.ts @@ -77,7 +77,7 @@ type CommonProviderConfig = { * @param input.userContext Refer to https://supertokens.com/docs/thirdparty/advanced-customizations/user-context */ validateAccessToken?: (input: { - accessTokenPayload: { [key: string]: any }; + accessToken: string; clientConfig: ProviderConfigForClientType; userContext: any; }) => Promise;