Doesn't that mean you need to do a database lookup to verify the user with every request? Seems like a lot of overhead just for the sake of avoiding sessions.
Doesn't that mean you need to do a database lookup to verify the user with every request? Seems like a lot of overhead just for the sake of avoiding sessions.
Alternatively, if a time limited token is practical, use a self-signed expiring token.
One reason to avoid sessions is security aspect of it. Cookies are handled automatically by the browser which opens the API up to XSS
AFAIK, neither signatures or "something you have, know" alone fixes replay attacks. Since this is a well known problem in cryptography, many solutions exists. All of which are probably overkill for this use.
The API user first gets a token using credentials. Future requests use the token for authentication.
A new token will be required periodically.
Is it because the authentication part is a lot of work for the server or client?
Is it for the negligible (in this context) security benefits of not using the same secret-key for all traffic?
Whether or not that is a lot of overhead depends also on how much work you were going to do to process the rest of the request. If your API allows sorting and filtering of a large data set, like the article suggests, then the authentication overhead is probably relatively small.
When the server receives the request it can simply decrypt the token and deserialize it into some sort of strongly typed usercontext.