hidroh / materialistic

A material-design Hacker News Android reader
https://play.google.com/store/apps/details?id=io.github.hidroh.materialistic
Apache License 2.0
2.3k stars 509 forks source link

Question about voting function #1434

Open ATClemente opened 4 years ago

ATClemente commented 4 years ago

https://github.com/hidroh/materialistic/blob/d767bdf44d85b3baf451706c919fba4f0ef3f74e/app/src/main/java/io/github/hidroh/materialistic/accounts/UserServicesClient.java#L193

This isn't really an issue but a question for @hidroh about the postVote function. Recently I've been messing around with the HN API and have found this app, as well as some other resources, that can do things not strictly supported by the API such as voting up a post. I see the function to do so and the web request assembles seems rather simple. However I have been trying to replicate in Postman as well as with the axios library and I am unable to get a successful vote submitted. The request always returns a 200 with the front page.

As I understand it we are making a POST request to the url: https://news.ycombinator.com/vote with form data parameters being: "acct", "pw", "id", "how". I am using valid account credentials, but I cannot get a vote to work correctly.

This method is different from others I've seen, where another way to send a vote request involves parsing the page to find the "auth" token needed for the particular item.

Just wondering why I might be having trouble replicating the method seen in your app here.