feat: add email custom claim
This commit is contained in:
@@ -15,6 +15,7 @@ let issuer = process.env.ISSUER || 'localhost:3333'
|
||||
let jwksOrigin = `https://${issuer}/`
|
||||
const audience = process.env.AUDIENCE || 'https://generic-audience'
|
||||
const adminCustomClaim = process.env.ADMIN_CUSTOM_CLAIM || 'https://unbound.se/admin'
|
||||
const emailCustomClaim = process.env.EMAIL_CUSTOM_CLAIM || 'https://unbound.se/email'
|
||||
|
||||
const debug = Debug('app')
|
||||
|
||||
@@ -54,7 +55,9 @@ app.post('/oauth/token', (req, res) => {
|
||||
keyid: thumbprint
|
||||
})
|
||||
|
||||
const token = session.customClaims.reduce((acc, claim) => {
|
||||
const emailClaim = {}
|
||||
emailClaim[emailCustomClaim] = session.email
|
||||
const token = [...session.customClaims, emailClaim].reduce((acc, claim) => {
|
||||
return {
|
||||
...acc,
|
||||
...claim
|
||||
|
||||
Reference in New Issue
Block a user