My React app uses Strap-3.2.2 as its backend server. MongoDB Atlas is my database.
From Strapi docs:
ctx.state.user
Previously the
ctx.state.user
was populated with the user information, its role and permissions. To avoid performance issues the role is the only populated relation on the user by default.
I’m seeking direction for current “best practices” (for Strapi ^3.2.x forward) to return the “ID” of the currently authenticated user from within a Controller module, e.g.
const { user } = ctx.state
I’ve searched Strapi docs, posts in Strapi’s forum and Slack channel, but I don’t see any clearly articulated direction for changing the default populated state to return the current user’s ID using ctx.state.user
Below are two posts I came across, but it would be excellent if Strapi would provide clear, succinct direction in its docs for custom populating the user state via services, etc.
Allow custom populate in ctx.state.user #6770
Fix/#7197/Change custom populate state to own service#7204
Thoughts?
Thanks… Jim