Skip to content

Commit

Permalink
Ability to map custom claims
Browse files Browse the repository at this point in the history
  • Loading branch information
OskarsPakers committed May 31, 2024
1 parent d1483a3 commit 83f2c71
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/routes/consent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ const extractSession = (
session.id_token.name = identity.traits.name
}

const traitsToMap = process.env.ID_TOKEN_TRAITS
console.log("traitsToMap", traitsToMap)
if (traitsToMap) {
const traits = traitsToMap.split(",")
for (const trait of traits) {
if (identity.traits[trait]) {
console.log("mapping trait", trait)
session.id_token[trait] = identity.traits[trait]
}
}
}

if (identity.updated_at) {
session.id_token.updated_at = Date.parse(identity.updated_at)
}
Expand Down

0 comments on commit 83f2c71

Please sign in to comment.