Skip to content

Commit 68ebac6

Browse files
committed
fix: when non string token, clean up the token
1 parent 040ca9e commit 68ebac6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/main.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ export async function getM2MToken<T = string>(
401401
throw new Error("getM2MToken: No access token returned");
402402
}
403403

404-
console.log("returning token: ", result.json.access_token);
405404
return result.json.access_token;
406405
} catch (error) {
407406
throw new Error(
@@ -471,6 +470,12 @@ export async function createKindeAPI(
471470
audience: [`${event.context.domains.kindeDomain}/api`],
472471
});
473472

473+
if (typeof token === "object") {
474+
token = JSON.stringify(token);
475+
token = token.replace(`"\\"`, "");
476+
token = token.replace(`\\""`, "");
477+
}
478+
474479
const callKindeAPI = async ({
475480
method,
476481
endpoint,

0 commit comments

Comments
 (0)