I need to get access to
req.kauth.grant
which is populated for sure - because printing req prints me this:
kauth: {
grant: Grant {
access_token: [Token],
refresh_token: undefined,
id_token: undefined,
token_type: undefined,
expires_in: undefined,
__raw: ....
}
but if I try to directly print like this
router.get('/', keycloak.protect(), async (req:Request, res:Response):Promise<void> => {
console.log(req.kauth);
res.send("hello");
});
I get:
[ERROR] 18:32:14 ⨯ Unable to compile TypeScript:
src/api/routes/elev.ts:11:21 - error TS2339: Property 'kauth' does not exist on type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
11 console.log(req.kauth);
It's my first time using Typescript with NodeJS, so if I'm missing something obvious, I'm sorry.
So, how can I access that field in this case?
Thanks :)