Re:A few tips for Web API design
by cmelbye on Wednesday December 22, 2010 @09:49AM
(#2031426)
I want to do this, but I'm not sure how to handle authentication. If you were to do this dogfooding approach in a new application, how would you handle internal authentication (from your frontend) and also how would you handle customer authentication (from their client apps)?
[ Parent
| on HN ]
You have multiple options.
If you use SSL, then it might be easiest to just use http authentication, transmitting the users credentials for each request, which is also the only official restful solution (each request should be independent of each other request).
If you don't want to do that, create an endpoint that takes username and password and returns a token which must then be present in each request (maybe even as part of the authorization header).
Or use OAuth.
Another option is the use of API keys that are separated into two types -- partners and end-users. The partner API keys would be bound to a particular end-point (e.g., the IP address of the web server) while the end-user API key could be used from anywhere (e.g., from a mobile device).
Re:A few tips for Web API design
by andrewmccall on Thursday December 23, 2010 @06:12AM
(#2034119)
The OAuth 2 spec addresses some of these points by providing the user-agent flow.
The only place where it falls down some is when it comes to actually creating users. It's fine with one of the other flows because you can authenticate as an application with client credentials.