Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no session management being done #87

Open
liquidcms opened this issue Sep 14, 2019 · 6 comments
Open

no session management being done #87

liquidcms opened this issue Sep 14, 2019 · 6 comments

Comments

@liquidcms
Copy link

I had this same issue with jDrupal 7 and now jDrupal 8. I also see this common thread hidden in a few of the other issues posted here: there is no session management being done with jDrupal.

If i do a userLogin it works great and returns the uid as well as a csrf token. But this isn't used anywhere either at the client or the Drupal host. So any following command that requires the access rights of the user that was just logged in; will fail.

I am not entirely sure of how this ties together between client and host; but a lot of good work done here by Tyler it would be a shame to scrap it all. I know for D7 i had to write some hook_init() code to set the session when a login call was used. Not sure if this is the same thing missing in D8.

@signalpoint
Copy link
Owner

@liquidcms Thank you for reporting this, so long ago!

I am now experiencing this with cordova + jDrupal 7 + ios. It still works fine for web applications and within cordova + android.

I know for D7 i had to write some hook_init() code to set the session when a login call was used.

Do you have a sample of that code?

@liquidcms
Copy link
Author

liquidcms commented Feb 4, 2021 via email

@signalpoint
Copy link
Owner

Hi Peter ( @liquidcms ) !

Thank you for still having some belief in this project :) You were (maybe one of the last) power users over the years and I sure appreciated your feedback. With my youngest now 4 years old, I feel like I am finally coming up for some air.

I can send you the entire project if you like. It's an ionic project.

That would be great. I will send you an e-mail now and perhaps we can connect through there.

As for the problem itself, I've been researching it and there is a lot of noise out there about cordova + ios + cookies in general, and lots of people having problems with them persisting. I've found some potential leads (including some Drupal 7 specific ones in the Services issue queue that mention hook_init() and settings.php) and will report back if/when I find a solution!

@signalpoint
Copy link
Owner

Older versions of cordova + ios used UIWebView (cordova-ios 5*), and now they use WKWebView (cordova-ios 6*), which apparently has a bug with cookies. I learned about this while browsing cordova-ios issues related to cookies.

Luckily, there is a plugin and some slight server modification that appear to fix it:

  1. install cordova-plugin-wkwebview-file-xhr.
  2. set your server's Access-Control-Allow-Headers to allow Content-Type and X-CSRF-Token (I did this in .htaccess)

I am now able to use cordova + ios + jDrupal for a Drupal 7 site and sessions/cookies are properly handled and maintained!

@liquidcms In the hopes of closing this issue, were you having this problem with just your iOS apps, or was this also happening with Android apps and/or Web apps too?

I just published a cordova + jdrupal 7 app for both Android and iOS. Not until I began the iOS publication process did I encounter session/cookie problems. All other environments worked fine (web app + same domain as D7 site, android app).

@liquidcms
Copy link
Author

liquidcms commented Feb 9, 2021 via email

@signalpoint
Copy link
Owner

With the latest version of cordova and android, the dreaded cookies vs session management problems seem to be back. See my comment here for a potential solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants