Oh yes that would make sense, as the middleware I’m guessing would decrypt the token and add the user state that you are looking for. No token no user state!
Sure. I sent a JWT token with Postman. I could see it inside the ctx. I used “Bearer token” as authorization.
With this code, I have no problem:
const user = await strapi.plugins[‘users-permissions’].services.jwt.getToken(ctx);
If ctx.state.user works, I can deduct that there is a problem with my request. But what?
Thank you for your help. I’d like to understand what’s wrong
Another thing, I created a policy file. Inside, I can access to the logged user.
So I can’t understand why I can access to this piece of information inside the policy and not in the controller.
Something’s rotten in the dutch kingdom…
I’ve found my mistake. In the customed route config, “auth” field was set to false. This explains why I couldn’t get the ctx.state.user. Sorry for the inconvenience