Hey Guys,

We've been using D8 for mobile backends for a while now and got pretty excited when seeing this new feature in 8.2

"Additional RPC endpoints: user/login user/login/status user/logout user/password/reset" as noted here: https://www.drupal.org/node/2720655

Have just updated to 8.2 Beta and no luck! Using postman the only response we are seeing when posting the documented data to: /user/login is an empty message.

When attempting to get a users status we get the following response:
{
"message": "No route found for \"GET /user/login/status\""
}

Has anyone had any luck validating a user's login credentials using Drupal's REST API?

Sure we could use the documented approach and post to /user/login?name=test&pass=password&form_id=user_login_ however as we know the response is HTML and status code is the same for success or fail so it's pretty nasty.

Any help on how to use the new RPC Endpoints would be much appreciated.

Thanks.

Comments

slewazimuth’s picture

Just saw this so I did a quick post to the new RPC endpoint on 8.2.0-beta1. Got json back with usual data. However, it also included csrf_token and logout_token. I used the information from your noted link and it worked right away.

Andrew211’s picture

Yeah tried again with no luck, this time updated to:

Drupal core 8.2.0-beta2

It's just a dev enviroment so gave permissions to all user roles access to all rest resources.

Ensured the only headers we are sending are that in the examples (no token or auth headers), EXACTLY as the documentation says.

Stumped.

Bit of topic, will start a new post for this, but when creating customs REST Resources, we always get the Route Not Found error:

{
"message": "No route found for \"POST /product/test\""
}

Any hints you can share?

Thanks.

slewazimuth’s picture

I saw the endpoint they activated was RPC so I made sure I installed services module before I tried doing one of their examples in curl.

Re:

{
"message": "No route found for \"POST /product/test\""
}

Usually indicates endpoint is not enabled/present.

Andrew211’s picture

Thanks for that, ended up being some issue with Postman, works perfect using CURL

Cheers