diff --git a/lib/build/customFramework.js b/lib/build/customFramework.js index 9326c42ef..e5e63fa76 100644 --- a/lib/build/customFramework.js +++ b/lib/build/customFramework.js @@ -18,9 +18,8 @@ const recipe_1 = __importDefault(require("./recipe/session/recipe")); const constants_1 = require("./recipe/session/constants"); const cookieAndHeaders_1 = require("./recipe/session/cookieAndHeaders"); const jwt_1 = require("./recipe/session/jwt"); -const jose_1 = require("jose"); -const supertokens_1 = __importDefault(require("./supertokens")); const accessToken_1 = require("./recipe/session/accessToken"); +const combinedRemoteJWKSet_1 = require("./combinedRemoteJWKSet"); function createPreParsedRequest(request, getCookieFn = getCookieFromRequest) { /** * This helper function can take any `Request` type of object @@ -177,12 +176,8 @@ async function getSessionForSSR(request, jwks) { const hasToken = !!accessToken; let jwksToUse = jwks; if (!jwks) { - const stInstance = supertokens_1.default.getInstanceOrThrowError(); - jwksToUse = jose_1.createRemoteJWKSet( - new URL( - `${stInstance.appInfo.apiDomain.getAsStringDangerous()}${stInstance.appInfo.apiBasePath.getAsStringDangerous()}/jwt/jwks.json` - ) - ); + const sessionRecipe = recipe_1.default.getInstanceOrThrowError(); + jwksToUse = combinedRemoteJWKSet_1.getCombinedJWKS(sessionRecipe.config); } try { if (accessToken) { diff --git a/lib/ts/customFramework.ts b/lib/ts/customFramework.ts index 544685fb1..1d0e9660a 100644 --- a/lib/ts/customFramework.ts +++ b/lib/ts/customFramework.ts @@ -11,10 +11,10 @@ import SessionRecipe from "./recipe/session/recipe"; import { availableTokenTransferMethods } from "./recipe/session/constants"; import { getToken } from "./recipe/session/cookieAndHeaders"; import { parseJWTWithoutSignatureVerification } from "./recipe/session/jwt"; -import { JWTPayload, createRemoteJWKSet } from "jose"; -import SuperTokens from "./supertokens"; +import { JWTPayload } from "jose"; import { HTTPMethod } from "./types"; import { getInfoFromAccessToken } from "./recipe/session/accessToken"; +import { getCombinedJWKS } from "./combinedRemoteJWKSet"; export type GetCookieFn = (req: T) => Record; @@ -209,12 +209,8 @@ export async function getSessionForSSR( let jwksToUse = jwks; if (!jwks) { - const stInstance = SuperTokens.getInstanceOrThrowError(); - jwksToUse = createRemoteJWKSet( - new URL( - `${stInstance.appInfo.apiDomain.getAsStringDangerous()}${stInstance.appInfo.apiBasePath.getAsStringDangerous()}/jwt/jwks.json` - ) - ); + const sessionRecipe = SessionRecipe.getInstanceOrThrowError(); + jwksToUse = getCombinedJWKS(sessionRecipe.config); } try {