Closed (outdated)
Project:
Services
Version:
7.x-3.12
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
16 Nov 2015 at 11:00 UTC
Updated:
16 Oct 2022 at 16:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
tyler.frankenstein commentedEnable the application/json format under your service settings, flush Drupal's caches, then make a POST to ?q=[endpoint-name]/user/login.json and be sure to attach the X-CSRF-Token header to your request with a value that can be retrieved here: ?q=services/session/token.
Comment #3
sivani123 commentedWhat you Mentioned in above like that only i did but i am getting blank page.
http://localhost/drupal/?q=final/user/login.jsonusername=12345&password=...
and token -1im5zxRZguYORJIwOwwNd4USagUXS_9wTHLG8jhmcc is this .
Postman I am using POST Method and passing these all things but I am not getting JSON Format.
can u plz help me in this issue
Comment #4
sivani123 commentedComment #5
sivani123 commentedComment #6
tyler.frankenstein commentedYou need to change the "login.jsonusername=" in your URL to "login.json&username=".
Comment #7
sivani123 commentedChanged to login.json&username= . But I am getting this like.
Comment #8
sivani123 commentedChanged to login.json&username= . But I am getting this like Access denied for user.
Comment #9
tyler.frankenstein commentedYou must be logged out in the browser/app when trying to login, even if you're in a different browser tab, the cookie is shared, and logged in users can't login again, access denied.
Comment #10
sivani123 commentedI am Closed all browser/app but again same access denied.
Comment #11
sivani123 commentedComment #12
sivani123 commentedComment #13
arun.mytimez commentedI think you are missing out on the 'X-CSRF-Token' header value. This is what gets your authentication through.
In Postman, create a header with name 'X-CSRF-Token' and the value should be what you get from calling 'http://localhost/drupal/services/session/token'. This should be there when you do your post to get your authentication working.
Comment #14
Tharick commentedCheck if there is any redirection code in your custom module.
Comment #15
jcnventura