Been playing with ERPNext a bit recently. Tried to test the REST API so as to learn how it works.
In the Frappe documentation, it says to login like this:
Tried the following code in my terminal and it worked
$ curl --data "usr=Administrator&pwd=admin" http://localhost:8000/api/method/login
However the API to test whether the user has been logged in was not working
$ curl http://localhost:8000/api/method/frappe.auth.get_logged_user
It would NOT work :-/
If i would paste the URL in my web browser, it would recognize that i was logged in.
I realized cookies are being used. To do it from the command line, all i had to do was create a cookie jar and later fetch the cookie from the jar 😉
$ curl --data "usr=Administrator&pwd=admin" http://localhost:8000/api/method/login --cookie-jar lol
$ curl http://localhost:8000/api/method/frappe.auth.get_logged_user --cookie lol
It would finally recognize me now. 😀