How to access ctx.state.user in a global middleware [strapi v4.14]

System Information
  • Strapi Version: 4.14
  • **Operating *:Windows 11 Home
  • Database: Sqlite
  • Node Version: 18.17.1
  • NPM Version: 9.6.7

I’ve edited a global middleware which gets author data to each operations to make some verifications. but I don’t access to ctx.state.user in that middleware.

module.exports = (config, { strapi }) => {
    return async (ctx, next) => {

        return next();

I’ve tried to access it even in some lifecycle files, but it’s the same thing.

When I console.log(ctx.state), it returns {} an empty object so I cannot access to ctx.state.user

Documentation didn’t help me

beforehand thanks for any help