How to get user id in Node/Express resource server

I set up the example Node/Express resource server and I’m wondering how to access the authenticated user’s id, group, etc. in the Express app so I can apply it to SQL queries there.
I have a case where an identifier from the Okta authenticated user needs to be mapped to a user id on the database so user (group) specific results are returned. Can you point me to a code example?

If you’re using @okta/oidc-middleware, you can use req.userinfo to get info about the authenticated user as shown here:

If you want groups, you’ll need to add the groups scope to the ExpressOIDC constructor:

Be aware of the current 100 group limitation

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.