TASK:
I want my web application to be able to send the username and password of the user on my Drupal website, to the Drupal website and respond to the Drupal website confirming that the user authentication information is correct.
Another need is for the Drupal server to return the session identifier for the created session and information for the user, such as email, user role, etc.
What I still have:
I turned on the Rest Rest Services server and created the endpoint at www.mysite.com/rest/. I set the response format for json only and requested a parser for the / x -www-form-urlencoded application. I turned on session authentication, debug mode. I have also included the entire user resource for this endpoint. Going to www.mysite.com/rest/user gives me a list of all users.
As for my authentication attempts, I tried to send requests:
POST www.mysite.com/rest/user/login Content-Type: application/x-www-form-urlencoded POST Body: name:admin, pass:myadminpassword
But it just returns 401 Unauthorized response. I checked twice and the authentication information is correct. I tried other options for parameter names, such as: (username, password), (user, password), (username, password), etc.
I canβt get the login to work, and I looked at other examples that I found in Stackoverflow, but they didnβt work.
user594044
source share