jwt functions are async now, await them

This commit is contained in:
Ulf Gebhardt 2023-05-05 17:19:28 +02:00
parent 36d40cbe40
commit 4f0910baf1
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
2 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ export const isAuthorized: AuthChecker<Context> = async ({ context }, rights) =>
}
// Decode the token
const decoded = decode(context.token)
const decoded = await decode(context.token)
if (!decoded) {
throw new LogError('403.13 - Client certificate revoked')
}
@ -49,6 +49,6 @@ export const isAuthorized: AuthChecker<Context> = async ({ context }, rights) =>
}
// set new header token
context.setHeaders.push({ key: 'token', value: encode(decoded.gradidoID) })
context.setHeaders.push({ key: 'token', value: await encode(decoded.gradidoID) })
return true
}

View File

@ -185,7 +185,7 @@ export class UserResolver {
context.setHeaders.push({
key: 'token',
value: encode(dbUser.gradidoID),
value: await encode(dbUser.gradidoID),
})
await EVENT_USER_LOGIN(dbUser)