Get user information about operations

Hi there. I hope this message finds you well.

I’m trying to get logged user information as a part of a process in a custom plugin . Is possible through ctx? I have the following structure:

Use case: Generate a message to send through an own services, informing what user was logged at moment to interact with Strapi Dashboard.

Plugin: A custom plugin do an internal request through a Home Component to a custom route /send-message, then the sendMessage controller is invoked. The payload for that request is an object with information about my process. At that moment, I’ll need do another request to one external API with: payload object + user info that information of the user who started the process with the call to action in the frontend component.

– The route works successfully.
– The controller works without problem, receiving the payload through ctx.request.body and processing the requeriment successfully

– Receive/process the user logged

What I tried
Access to ctx.state
Access to ctx.request
Access to ctx.state.user
Access to Strapi object (undefined here)
Access to Authenticator.

Mi route looks like:

  method: 'POST',
  path: '/send-messages',
  handler: 'sendMessages.index',
  config: {
    policies: [],
    auth: true,

I hope somebody can help me. If is necessary more information, I'll available to add info.

Thanks a lot!

<i>This topic has been created from a Discord post (1227705266808815696) to give it more visibility.
It will be on Read-Only mode here.
<a href="">Join the conversation on Discord</a></i>

remove auth: true and user information will be in ctx.state.user assuming that a JWT was used

you just need to make sure the route is a content-api route, not an admin route.