signalpoint / jDrupal

A JavaScript Library and API for Drupal Applications
http://jdrupal.tylerfrankenstein.com/
GNU General Public License v2.0
76 stars 38 forks source link

logout seems not working in test.html #66

Open dgurwan opened 7 years ago

dgurwan commented 7 years ago

When running test.html, logout doesnt not work, any clues ? here's console log

GET XHR http://drupal-7-26.dd:8083/ [HTTP/1.1 200 OK 549 ms] "POST: http://drupal-7-26.dd:8083/?q=rest/system/connect.json" jdrupal.min.js:2:63 OPTIONS XHR http://drupal-7-26.dd:8083/ [HTTP/1.1 200 OK 524 ms] POST XHR http://drupal-7-26.dd:8083/ [HTTP/1.1 200 OK 599 ms] 200 - OK

All is ok , when clicking on login, a popup is displayed with "Hi admin-local", seems good... but logout

"POST: http://drupal-7-26.dd:8083/?q=rest/user/logout.json" jdrupal.min.js:2:63 OPTIONS XHR http://drupal-7-26.dd:8083/ [HTTP/1.1 200 OK 542 ms] POST XHR http://drupal-7-26.dd:8083/ [HTTP/1.1 406 Not Acceptable : User is not logged in. 637 ms] "POST: http://drupal-7-26.dd:8083/?q=rest/user/logout.json - 406 - Not Acceptable : User is not logged in." jdrupal.min.js:2:547

["User is not logged in."] jdrupal.min.js:2:631 Expires: Sun, 19 Nov 1978 05:00:00 GMT

Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0

Last-Modified: Mon, 20 Mar 2017 22:17:06 GMT

Content-Type: application/json

signalpoint commented 7 years ago

@dgurwan What URL are you running the tests at? I suspect the domain on the URL is different than http://drupal-7.26.dd:8083. If the domain is different, then you're experiencing what is referred to as CORS. There's plenty of DrupalGap/Drupal related issues discussing CORS which will help you.

FYI, Drupal 7.26 is super duper in secure... I'd advise upgrading if you haven't.

dgurwan commented 7 years ago

@signalpoint , test is running on localhost as drupal-7.26.dd:8083 which is declared in my host file. I use FF with cors module to Allow-Control-Allow-Origin: *.

I know that 7.26 is really old, but can not change it for now unfortunately.. Does the pb can be a session pb on service module,by the way i checked "Session authentication" in my service.

thx by advance :)

dgurwan commented 7 years ago

@signalpoint , I just tried with a fresh drupal installation (7.46 + libraries + Services ) on remote site (http://myangulardrupal3neb62rbwg.devcloud.acquia-sites.com), connect is all good, but not logout.

Let me know if i'm doing wrong

signalpoint commented 7 years ago

@dgurwan

406 - Not Acceptable : User is not logged in.

This leads me to believe that there may be something wrong with the Drupal cookie and the cookie domain configuration. Fortunately/unfortunately, I've never had to deal with this in any of my hosting environments, but I've heard many others mention a "Drupal cookie domain".

I think this could be a problem with Acquia vs. the Services module, but I'm not familiar with Acquia's environments.