7

Following the answer from here : Strapi : is it possible to track users modifying content?

How do I get current user id?

zevskiel
  • 71
  • 1
  • 2

1 Answers1

17

ctx.state.user in Controller has authenticated user's data.

Shaz
  • 597
  • 4
  • 5
  • Hi, I'm using graphql and can only override in `service`, any idea how I can retrieve the `ctx` in service? I need to know the user that makes the request too – Zennichimaro Jan 10 '22 at 13:17
  • This would return `undefined` if your route has no auth policy like `policies: ['admin::isAuthenticatedAdmin']` – Jean Claveau Sep 19 '22 at 11:36