I use nestjs, and use node-oidc-provider package to make and identity provider, but currently stack how to add another property in my JWT access token?
The reason behind this basically i want to add roles property attach in jwt token, is so every time api call with bearer authorization, because want to protected the certain api endpoint only can be accessed by certain roles, i have such a guard middleware that decrypt the access token and check the roles property before can be allowed to hit the api,
here my code to make access token in jwt format, but i wonder where i ca set to attach another property?
resourceIndicators: {
defaultResource(ctx) {
return ctx.origin;
},
getResourceServerInfo(ctx, resourceIndicator, client) {
return {
scope: client.scope as string,
audience: 'account',
accessTokenFormat: 'jwt',
};
},
useGrantedResource(ctx, model) {
return true;
},
},