Skip to content

After logging in, Access denied for user anonymous #74

@BarryAbrams

Description

@BarryAbrams

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);
	    }
	});
  }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions