Comments are Posted anonymously

Solutions

The default for an unprovided uid property to a comment entity is 0, so with your current code it will always be owned by an anonymous user. If you want a specific user, you have to be specific in the request.

It can just go straight in the payload though:

{
  "nid": "401",
  "uid": "123",
  "subject": "Comment Subject sdfsdf ",
  "comment_body": {
    "und": [
      {
        "value": "Comments body sdfsnd fsd fds "
      }
    ]
  }
}

You have access to uid from the return value from the login, so it's easy to get hold of.

Similar questions

Comments - Allow deletion of comments on your content without Administer Comments permission?
Is there a way to allow users to delete comments that are on their own content without giving access to Administer Comments? Example: Authenticated user makes a blog post (or some node content) Another Authenticated user comments on it Author does not like comment- wishes to delete. The only option I have is edit/reply.
Facebook: Using my drupal comments system and FB comments all at the same time, and storing comments inside my own site and not FB?
I´ve just started to test, use and play with facebook apps. I´ve searched stackoverflow but didn´t find exactly what I need, so, here I am. I´ve a drupal site. I´ve installed the Facebook for Drupal module, so I can use facebook in my site. I want users to be able to post comments in my site without creating for them any account. I can use that mod...
Using a select form field for the field that selects the groups where a node is posted
The form for creating a node for the content type that has been set as content type for the Organic Groups module has checkboxes for choosing the groups where a node is posted; I want to use a select form field instead of the checkboxes. How should I alter the form field? I have tried some patches from drupal.org, but they do not works correctly. I...
Show activities on users' posted content
I would like to provide a view, and something like a newsletter, where the users can see what actions (e.g. commented) are done on their posted content. I thought I could do this with Activity, but I can only catch the events the users did on their posts. Do have any idea on how to provide this?
What is the machine name for the Date Posted?
I'm using Views and have it set to fields. Can anyone tell me what the machine name of Content: Post date is? I used Time ago in my selection.
How to create a view displaying nodes posted in the logged-in user groups?
I can't figure out how to create a view listing all nodes from the logged-in user groups. This was easy with Drupal 6 version of Organic groups, but with the entity based version, it is not obvious (or maybe not doable without some views data hooks). Thanks for your help.

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.