Closed (works as designed)
Project:
Services
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
16 Dec 2015 at 14:51 UTC
Updated:
12 Feb 2016 at 21:11 UTC
Jump to comment: Most recent
Comments
Comment #2
tyler.frankenstein commentedJust use
?q=services/session/tokenfor a plain text token retrieved with a simple GET request.Comment #3
kylebrowning commentedhttps://github.com/kylebrowning/drupal-ios-sdk/tree/2.x Does this automatically for you.
Comment #4
NextGame commentedThank you for your responses. Will review and keep you posted on the outcome. Appreciated.
Comment #5
srinath7 commentedI ran into a very similar issue today with my apps in production (built with Services and Drupalgap). The apps were working perfectly fine until the day before.
At first the apps wouldn't load. Upon debugging (using XCode and Ripple) I found that the Session token being retrieved from services.module, had a prefixed newline character. This newline is NOT generated by the function drupal_get_token, however I see it in the response received by jDrupal. I'm flummoxed and as a temporary fix, have put in a token=token.trim() in the jDrupal function services_get_csrf_token(), after I receive the token. And now it works just fine. I would definitely be glad to know the root cause for this.
I'm really unsure what caused the server/apps to start functioning different. I don't think it's a Services module issue, cause I have the same setup running on localhost and it works just fine. I'm beginning to think it's got to do with the server config. I recently moved to https, and am wondering if any server updates coupled with that https move had a part to play.
EDIT: I figured the cause of my troubles. It was a .php file I had included. In the script, I had closed the file with a ?> followed by a 'return'. I realize it is best practice to NOT close php files with ?> specifically to avoid such errors. Found it out the hard way!
Reference: http://askubuntu.com/questions/175870/apache-or-php-inserting-a-newline-...
Comment #6
tyler.frankenstein commentedThanks for following up with this information, it is helpful for folks using Services, and/or DrupalGap and/or jDrupal.