I am logged in to my Drupal account and if I use the jQuery code from here then I can make a post request to my site and create a node. But if I try from another site, like my local host or a third party site, I get 403 error.

I tried with a Get request from here, using jQuery, I could perform get the request, on both the Drupal site and an external site.

But I am unable to post, patch or delete from an external site using jquery and cookie authentication.

I'm not sure but I have a feeling it has something to do with the cookie not being sent with the request?

I can use basic_authentication but that requires the login credentials to be sent, which I do not want.

how can I get the cookie authentication to work with jQuery?


1 Answer 1


how can I get the cookie authentication to work with jQuery?

This is not possible. See this SO answer; the browser only allows you to use JS to access the cookies for the current domain; you cannot use JS to access cookies from other domains.

This is a basic security feature of modern browsers.


  • Implement Simple OAuth on the server
  • Implement JWT on the server
  • Implement something like Capacitor HTTP plugin for giving the browser access to your domain's cookies in all of your clients

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.