How do I add the “PUT” methode to the users/me api?
I’ve already tried the online tutorial Update your own user data - YouTube
but the files he is referring to in his git don’t exist anymore (I guess it’s obsolete since it’s from 2020), and I tried to implement in locally but it doesn’t work.
Or any way to restrict “PUT” method on the /users/:id api to only the user itself?
Is there really no way still to update the users own account without exposing the users/:id update path? I’m not sure if that’s an oversight in Strapi development, but it’s really blocking my progress with strapi. The JS repository does not work for me. The route gets registered but I always get 403 even with a valid jwt
I see what you are saying but it would say the best solution currently is making an extension for a path users/me and as method put then I would just make a middleware what sets the ctx.state.user.id to ctx.params.id and then just use as the handler user.update
what does this do the middleware sets the the id in user/:id and then just sends the request to the update controller update uses this would most likely give you the least amount of issues/ maintenance in the long run
I will most likely write a quick plugin later today and push it to github that does this for you. since I think that that is currently the best solution to this problem.
Update talked to derrick and he asked me to implement it in users-permissions
This is a great response. My only gripe with this is that it does not return errors/response in the same way as other endpoints do. Like, For register endpoint, for example, has this response. ok or response.error.details for error details.