3

I'm attempting Authenticating applications using the cURL example in the documentation [1] to request an access token. I'm getting the following error:

{"error":"json_parse","timestamp":1390766173799,"duration":0,"exception":"org.co
dehaus.jackson.JsonParseException","error_description":"Unexpected character (''
' (code 39)): expected a valid value (number, String, array, object, 'true', 'fa
lse' or 'null')\n at [Source: org.usergrid.rest.filters.MeteringFilter$InputStre
amAdapter@22838071; line: 1, column: 2]"}

I've tried the Authenticating application users cURL example [2] as well. It returns the same error. I actually started here, but thought maybe I had some issue with the user, so I tried to authenticate the application. I'm pretty sure I have the correct client_credentials.

Not sure what the issue is here. Looks like it's choking on the single quote, but I've seen other examples posted here that apparently use the single quote successfully. My cURL installation seems to be working fine otherwise (I thought maybe I had an issue in configuration).

Is it possible there is some bug/misconfiguration on Apigee side? or maybe the example code is wrong :/

[1] http://apigee.com/docs/app-services/content/authenticating-users-and-application-clients#authenticating-applications [2] http://apigee.com/docs/app-services/content/authenticating-users-and-application-clients#authenticating-application-users-user-login-

user1048553
  • 146
  • 1
  • 3
  • Just a guess, but have you tried using double quotes around the parameter value (and then escaping the quotes inside the value as `\"`, of course) …? – CBroe Jan 26 '14 at 21:33
  • Can you please provide the exact curl command request? It will help in resolving this faster. – Srikanth Jan 27 '14 at 04:28

2 Answers2

6

it's a windows issue, try replace ' with " and " with """, see:

http://elasticsearch-users.115913.n3.nabble.com/new-windows-install-td3021742.html

0

You can try to check if the json payload you are sending is valid. You can validate any json payload at this site http://jsoneditoronline.org

Also, if your password contains some special characters that might interfere with the JSON or curl, you should try escaping those with a backslash. Let's say you have a singlequote, a doublequote or a backslash in your password

like test"adminpw

You should try to escape that character using a backslash '\' like below

curl -X POST -i -H "Content-Type: application/json" "https://api.usergrid.com/management/token"  -d '{"grant_type":"password","username":"testadmin","password":"test\"adminpw"}'
Santanu Dey
  • 2,900
  • 3
  • 24
  • 38