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

After logging in, Access denied for user anonymous #74

Open
BarryAbrams opened this issue Jul 10, 2017 · 3 comments
Open

After logging in, Access denied for user anonymous #74

BarryAbrams opened this issue Jul 10, 2017 · 3 comments

Comments

@BarryAbrams
Copy link

BarryAbrams commented Jul 10, 2017

I'm having some trouble staying logged in with jDrupal 7. I'm using phonegap.

I can perform a successful system_connect, and user_login, but I'm getting "Access denied for user anonymous" when I try a node_save afterwards. If I run an Console.log(Drupal) I can see that user.uid is set to 0, before or after user_login.

I'm not sure what I'm doing wrong. Here's a simplified version of my code:

system_connect({
  success: function(result) {
  	console.log("connected to drupal");
	  user_login("admin", "password", {
	    success:function(result){
			console.log("logged in");
			var node = {
			  title: "Hello World",
			  type: "article"
			};
			node_save(node, {
			  success: function(result) {
			    alert("Saved node #" + result.nid);
			  }
			});
	    },
	    error:function(xhr, status, message){
	      alert(message);
	    }
	});
  }
});
@liquidcms
Copy link

Yes, years later.. but hoping jDrupal is still an active project (but sadly i think it isn't).

I have the same issue. When i do a user_login() the result is the logged in user object; but this isn't being set to Drupal.user and my guess is this has something to do with not getting new CSRF token. I am not seeing any console.log errors though except for CORB warnings which i assume are not too big a deal as the user object for the logged in user is returned successfully.

@liquidcms
Copy link

i think this issue is with system_connect. It returns a sessid, session_name; but data.user is for anon user.

perhaps a bit of a rabbit hole here as this is pretty old now and likely no longer supported.

@signalpoint
Copy link
Owner

@BarryAbrams @liquidcms Add a couple more years... and I am experiencing this too w/ cordova + jdrupal 7 + ios.

I'll be investigating how to solve this issue, but wanted to let you know that I don't experience this when building a web application, and do not experience it with cordova + jdrupal 7 + android.

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

3 participants