I am trying to make a basic auth for an API in Clojure with friend.
Here is the login request :
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'user=myuser%40email.com&pass=super-secret-password' http://localhost:3000/login/
I am using compojure as well, but I'm not sure how to reuse the linked example. Here are the parts that I don't know how to change :
How do I replace the username/password fields with user/pass fields like in my curl request ? I am able to extract them from the raw request, but I don't know how to pass it to Friend (do I need to change the
Replace the user atom with data from the database. I have a
auth [email password]that returns true or false (fetching from the database and using bcrypt). I can also fetch the user role from the database. How do I use the database (specifically I use mongo/monger) instead of the user atom ?