Skip to content

Commit

Permalink
fix: minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Sep 11, 2024
1 parent cba1ce5 commit 471e282
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions lib/build/recipe/oauth2provider/recipeImplementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function getRecipeInterface(
input.userContext
);
if (resp.status === "OK") {
const redirectTo = resp.redirectTo;
const redirectTo = getUpdatedRedirectTo(appInfo, resp.redirectTo);
if (redirectTo === undefined) {
throw new Error(resp.body);
}
Expand Down Expand Up @@ -283,9 +283,9 @@ function getRecipeInterface(
},
tokenExchange: async function (input) {
var _a, _b;
const body = {};
const inputBody = {};
for (const key in input.body) {
body[key] = input.body[key];
inputBody[key] = input.body[key];
}
if (input.body.grant_type === "refresh_token") {
const scopes =
Expand Down Expand Up @@ -330,19 +330,19 @@ function getRecipeInterface(
scopes,
userContext: input.userContext,
});
body["session"] = {
inputBody["session"] = {
id_token: idToken,
access_token: accessTokenPayload,
};
saveTokensForHook(sessionHandle, idToken, accessTokenPayload);
}
}
if (input.authorizationHeader) {
body["authorizationHeader"] = input.authorizationHeader;
inputBody["authorizationHeader"] = input.authorizationHeader;
}
const res = await querier.sendPostRequest(
new normalisedURLPath_1.default(`/recipe/oauth/token`),
{ body, iss: await this.getIssuer({ userContext: input.userContext }) },
{ inputBody, iss: await this.getIssuer({ userContext: input.userContext }) },
input.userContext
);
if (res.status !== "OK") {
Expand Down
12 changes: 6 additions & 6 deletions lib/ts/recipe/oauth2provider/recipeImplementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export default function getRecipeInterface(
);

if (resp.status === "OK") {
const redirectTo = resp.redirectTo;
const redirectTo = getUpdatedRedirectTo(appInfo, resp.redirectTo);
if (redirectTo === undefined) {
throw new Error(resp.body);
}
Expand Down Expand Up @@ -263,9 +263,9 @@ export default function getRecipeInterface(
},

tokenExchange: async function (this: RecipeInterface, input) {
const body: any = {};
const inputBody: any = {};
for (const key in input.body) {
body[key] = input.body[key];
inputBody[key] = input.body[key];
}

if (input.body.grant_type === "refresh_token") {
Expand Down Expand Up @@ -309,7 +309,7 @@ export default function getRecipeInterface(
scopes,
userContext: input.userContext,
});
body["session"] = {
inputBody["session"] = {
id_token: idToken,
access_token: accessTokenPayload,
};
Expand All @@ -319,12 +319,12 @@ export default function getRecipeInterface(
}

if (input.authorizationHeader) {
body["authorizationHeader"] = input.authorizationHeader;
inputBody["authorizationHeader"] = input.authorizationHeader;
}

const res = await querier.sendPostRequest(
new NormalisedURLPath(`/recipe/oauth/token`),
{ body, iss: await this.getIssuer({ userContext: input.userContext }) },
{ inputBody, iss: await this.getIssuer({ userContext: input.userContext }) },
input.userContext
);

Expand Down

0 comments on commit 471e282

Please sign in to comment.