Skip to content

Commit

Permalink
fix(tokens): id token not using issuer config
Browse files Browse the repository at this point in the history
  • Loading branch information
jagregory committed Nov 27, 2021
1 parent e5c08dc commit c488810
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const defaults: Config = {
UsernameAttributes: ["email"],
},
TokenConfig: {
// TODO: this needs to match the actual host/port we started the server on
IssuerDomain: "http://localhost:9229",
},
};
Expand Down
6 changes: 3 additions & 3 deletions src/services/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export async function generateTokens(
const sub = attributeValue("sub", user.Attributes);
const config = await loadConfig();

const issuer = `${config.TokenConfig.IssuerDomain}/${userPoolId}`;
return {
AccessToken: jwt.sign(
{
Expand All @@ -47,7 +48,7 @@ export async function generateTokens(
PrivateKey.pem,
{
algorithm: "RS256",
issuer: `${config.TokenConfig.IssuerDomain}/${userPoolId}`,
issuer,
expiresIn: "24h",
keyid: "CognitoLocal",
}
Expand All @@ -65,8 +66,7 @@ export async function generateTokens(
PrivateKey.pem,
{
algorithm: "RS256",
// TODO: this needs to match the actual host/port we started the server on
issuer: `http://localhost:9229/${userPoolId}`,
issuer,
expiresIn: "24h",
audience: clientId,
keyid: "CognitoLocal",
Expand Down

0 comments on commit c488810

Please sign in to comment.