-
Notifications
You must be signed in to change notification settings - Fork 33
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
Anonymous user is always returned after logging in. #34
Comments
@jonnadams I'm not familiar with D7 REST, so I can't tell for sure: are you working with D8? |
Looks like he is using D8 there. I think there is now a problem this module alongside Drupal 8.2, I believe the login mechanism has changed: https://www.drupal.org/documentation/modules/rest/javascript#comment-11731955 So I think we need to change this in jDrupal here: https://github.com/easystreet3/jDrupal/blob/8.x-1.x/src/includes/rest.inc.js#L82 Plus, for both D7 and D8, I believe the new |
I believe your correct signalpoint I am unable to login with D8.2.3. I think it "may" have something to do with: https://www.drupal.org/node/2403307? I am unsure though. I cannot seem to find out what changed in the api. |
@webdobe Last week I updated jDrupal to work properly with D8.2.*, so I think if you just download the latest jdrupal.min.js and include it in your index.html file, then angular-drupal should start working again for user login. |
Hmm I have the latest... I think it may have something to do with CORS. With the change of adding CORS config to a separate YAML file. I am having a hard time finding out how to make this work correctly.... Ok so While I was typing this I logged some connections. It appears that I need to be sending my requests to drupal using withCredentials set to true. Since jdrupal is using XMLHttpRequest; I am unable to use angular's httpprovider interceptor to change the withCredentials on the request.
Instead I have to be able to do this:
Maybe you have an idea? |
Well I found the:
So I bet I can do something with that. But where do I use the hook? |
Figured it out. I had to add
Outside the service. |
@webdobe Can you go into more detail in how/where you implemented this in your angular app? |
@jsheffers So the modulename_res_pre_process(xhr) function I placed in my user service file but outside the service. But you need to add the drupal.modules['modulename'] within your service. This is then added to every rest call stating that your sending withCredentials. The rest of the CORS configuration is done in the services.yml file in drupal 8.x-3.x+ My Cors config looks like this (sites/default/services.yml):
Make sure to clear your cache after making the cors changes as drupal 8 I believe caches all this. Additionally, you may need to setup # cookie_domain: '.example.com' in your services.yml file this will make sure that your cookies are passed to the app. Hense the withCredentials bit. |
As the title states the anonymous user is always returned when trying to log in.
You can see my drupal configuration here. I wanted to make sure that permissions weren't the issue so I opened them up.
Any help on the matter would be greatly appreciated.
The text was updated successfully, but these errors were encountered: