Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I'm trying with no success to update users with Services 7.x-3.19 and Drupal 7.56.
I can login, logout and register but I can't get user information or update it.
I followed this: http://tylerfrankenstein.com/user/4/code/drupal-services-examples
So I introduce X-CSRF-Token and also the Cookie formed by session_name=sessid in headers but I'm always getting: "Access denied for user anonymous"
What am I missing?
Thanks for your help!
j.
Comments
Comment #2
jeepster CreditAttribution: jeepster commentedI solved by:
Checking Session authentication in Endpoint edit, adding a token before login and changing it for the returned token with login.
So.
1. Get a token with endpoint/user/token
2. Login with X-CSRF-Token = token in headers: endpoint/user/login.json
3. Change X-CSRF-Token for the new token received after login
4. Get user information with endpoint/user/67.json and X-CSRF-Token in headers
5. Put new user information with endpoint/user/67.json and X-CSRF-Token in headers
No Cookie was needed.
I hope it helps.
Comment #3
tyler.frankenstein CreditAttribution: tyler.frankenstein commentedThank you for following up with the solution!