I'm sorry to put another REST Authenticate question on the website but I really need to get a complete answer. I have a REST API in which I try to log in a single page website (through jquery).
I want to create a token based authentication, but there is some step I still can't understand.
At first, do I have to make a normal authentication to get and store in db the user login/password ? Do I have to use the user session to store the token ? Does someone have an exemple of php code that I can use ?
source :
- PHP rest API authentication
- http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/
----------- EDIT ---------------
Ok, I have some news to add.
- First, Yes I have to make a normal authentification by sending the pair login, sha1(login+passwd)
- After, No, never use the session like a secure way to store data, the login and sha1(login+passwd) will be store in database or in a application scope storing solution, like an haspmap.
- But I still need you if you have a piece of php code. It's the reason why I put my answer as an edit.