Am trying to access my Reddit user's account by using the Reddit API - POST login Endpoint listed on its API page.
I tried this:
curl -i -X POST -d '{"user":"myusername", "passwd":"mypassword", "rem":"true" }' http://www.reddit.com/api/login
But it said wrong password (I logged into the website with the same credentials so I don't know what's wrong):
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
{
"jquery":
[[0, 1, "call", ["body"]], [1, 2, "attr", "find"],
[2, 3, "call", [".status"]], [3, 4, "attr", "hide"],
[4, 5, "call", []], [5, 6, "attr", "html"],
[6, 7, "call", [""]], [7, 8, "attr", "end"],
[8, 9, "call", []], [0, 10, "attr", "find"],
[10, 11, "call", [".error.WRONG_PASSWORD.field-passwd"]],
[11, 12, "attr", "show"], [12, 13, "call", []],
[13, 14, "attr", "text"], [14, 15, "call", ["invalid password"]],
[15, 16, "attr", "end"], [16, 17, "call", []]]
}
However, this works:
curl -i -c Cookie.txt -d '{"user":"myusername", "passwd":"mypassword" , "rem":"true"}' http://www.reddit.com/api/login
Yields:
{
"jquery":
[[0, 1, "call", ["body"]],
[1, 2, "attr", "find"],
[2, 3, "call", [".status"]],
[3, 4, "attr", "hide"],
[4, 5, "call", []],
[5, 6, "attr", "html"],
[6, 7, "call", [""]],
[7, 8, "attr", "end"],
[8, 9, "call", []],
[0, 10, "attr", "find"],
[10, 11, "call", [".error.RATELIMIT.field-vdelay"]],
[11, 12, "attr", "show"],
[12, 13, "call", []],
[13, 14, "attr", "text"],
[14, 15, "call",
["you are doing that too much. try again in 4 minutes."]],
[15, 16, "attr", "end"], [16, 17, "call", []]]
}
This also works as well:
curl -b Cookie.txt http://www.reddit.com/api/me.json
Questions:
Does anyone know how to login to Reddit using the Reddit API?
Is there an easier way to pass credentials via an HTTP Post to login correctly?
Why does it say invalid password from my initial curl?