Linked Questions

3 votes
1 answer
9k views

How to login into Drupal 8 using the REST API? [duplicate]

Ok i've spent my whole afternoon trying to get this running: Setup a freshly installed Drupal 8 Activate the WebServices (HAL, HTTP Basic Auth, Restful Webservices, Serialization) Install REST UI ...
jebbie's user avatar
  • 131
2 votes
1 answer
1k views

Can't log in user with Rest service [duplicate]

i'm trying to build a Headless Drupal app with symfony, i'm stuck with login, i build a custom module for drupal 8 with four functions, (login,logout,register,login_status): <?php /** * @file * ...
Fariss Abdo's user avatar
0 votes
0 answers
666 views

User login REST POST returns HTML format [duplicate]

I want to login to drupal through JSON, I read this issue, but non of the proposed solutions helped me do that using Postman on drupal 8.2.5. specially when I send this specification : POST: http://...
Mdeh's user avatar
  • 229
5 votes
5 answers
7k views

403 Forbidden when creating a page with RESTful API

Referencing this tutorial, I am trying to create a page with RESTful API: { "_links":{ "type":{ "href":"http://www.example.com/drupal/rest/type/node/page" } }, "title":[ { ...
Raptor's user avatar
  • 393
1 vote
1 answer
1k views

Login via REST fails (403 forbidden) if cookie set by Drupal is kept

I am trying to login via an Ajax request. I don't need any fancy REST features, I just want to login. According to the docs and other questions here it should be pretty straightforward for Drupal 8.3....
peanutman's user avatar
  • 113
-1 votes
1 answer
1k views

Web service APIs returns HTML content instead of JSON response

I have used Drupal 7 before and the web services were working perfectly fine. I recently started working on Drupal 8 (8.8 to be precise), and the login service is not working properly. When I do not ...
Guest's user avatar
  • 17
0 votes
1 answer
590 views

How do I log in a user?

I want to log in Drupal 8 users from an external PHP file. I am trying the following code. use Drupal\Core\DrupalKernel; use Symfony\Component\HttpFoundation\Request; use Drupal\user\UserInterface; //$...
sourabh's user avatar
3 votes
1 answer
622 views

Creating an API via module routing files that includes csrf verification headers

I am working on migrating a custom API from D7 to D8 and am doing so by using module routing. I have a routing.yml file that looks like so: ytp_user.api.login: path: "/api/v1/user/login" ...
BlondeSwan's user avatar
0 votes
1 answer
597 views

Doing a post to create a node using Drupal services endpoint with Postman app

I got my endpoint setup and I'm able to to do a get request to return a bunch of nodes. But I'm having issues doing a POST to create a new node. I see that I would first need to do a user login post ...
Patoshi パトシ's user avatar
2 votes
1 answer
332 views

Safe way to authentication users with REST

I can authentication and login user with below code in Jquery $.ajax({ url : "http://domain.com/user/login", type : 'post', data : 'form_id=user_login_form&name=' + encodeURIComponent(...
Yuseferi's user avatar
  • 22k
0 votes
1 answer
252 views

user login by php code

i have an app that sends username and password to a php script. This script checks that a user exists on Drupal 8 with username and password entered but does not log the user. I need the user to log ...
falconenero's user avatar