Skip to content Skip to sidebar Skip to footer

Express Body-parser: Unexpected Token # In JSON At Position 0

I am trying to return user data from a login with Polymer. I have it working with Postman, but am having trouble translating it into Polymer. In Postman this returns a JSON object,

Solution 1:

The problem is your POST body is empty (as seen in the screenshot of your request payload). You're attempting to pass the user credentials via <iron-ajax>.params, which is intended to augment the URL query parameters (notice how the request URL contains the user credentials as parameters).

To set the POST body, set <iron-ajax>.body (and change this.params to this.body) instead:

<iron-ajax body="[[body]]" ...>

demo


Post a Comment for "Express Body-parser: Unexpected Token # In JSON At Position 0"