I can't log in consistently via Services 3 in Drupal 7.
POST http://<mydrupaldomain>/services/user/login.json
{
"username":"admin",
"password":"password"
}
- The first time I make this request I get a session name and id back. Which is what I want. I use the session information to make successive calls such as update user.
- The second time I make this request the response comes back as HTML for the login screen.
- The third time I get
401 Unauthorized: Access denied for user anonymous
- And at the forth time I get am able to login again with a NEW session name and id.
I make these requests within seconds of each other. I will have an application which will be making multiple API calls to Drupal per second. This includes creating a user and updating a user both of which requires that I get a user session id in order for the request to be served by the API.
Questions: Why the inconsistent behavior? On each login attempt I expected to get either a new session info back or, if the user is already logged in, the current session.
What is the proper way of retrieving and handling sessions when making multiple calls to the Services API?