Re:Why and How You Should Write REST-Centric Applications
by Sym3tri on Wednesday May 18, 2011 @11:59AM
(#2560562)
Authentication and need for at least a pseudo "session state" always seems like the trickiest part of building a 100% RESTful app. Anyone have details/examples on ways to address these?
[ Parent
| on HN ]
Re:Why and How You Should Write REST-Centric Applications
by ataggart on Wednesday May 18, 2011 @01:02PM
(#2560779)
One approach I've seen regarding auth is to use a faux-resource:
Login:
PUT https://example.com/credentials
{"username":"foo", "password":"bar"}
Check if user is logged in: HEAD http://example.com/credentials
Cookie: ...
Get current user: GET http://example.com/credentials
Cookie: ...
Logout: DELETE http://example.com/credentials
Cookie: ...
From the point of view of the one client, it's no less "real" than any other resource.