How to get users' own data from a collection?
After a successful login, /auth/login does not return user-related info except the Bearer token.
So how do I request only the logged-in users' data from a collection?
While using GraphQL I can filter my result by this way if I knew my user ID. But I don't think it's the best way.
(filter:{user_created:{id:{_eq: "59d5bc57-6a67-4200-b435-553403c5b503"} }})
It's in the docs. :)
https://docs.directus.io/reference/api/system/users/?#retrieve-the-current-user
The endpoint "${api_url}/users/me" will return the information for the currently authenticated user. You should be able to map this to GQL as you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With