I have just started reading on implementing RESTful web services and creating RESTful apis. I have understood the basic concept of REST but I have been scratching my head a bit on how I will implement it securely?
Say for example, my webapp has a user login process. After successfully logging in, what else should I pass in the RESTful request to authenticate on server??? What I can think of is the following process:
- user logs in (POST username/password to API)
- API responds with a userkey
- userkey is stored locally
- When making any further requests, I include this key in request be authenticated
But here it seems that userkey
is a state which I am sending to API, but REST happens to be stateless. Also this is not too secure in case of sending GET
requests.
Is OAUTH the solution to my dilemma? Or some other way? Can somebody guide me on this...
Thanks