I need users to authenticate through a form, but I also need to expose this authentication as an API for use by other applications/devices.
Obviously I want to keep things simple and avoid duplication, so how should I approach this? Should I use a single URI for both user login and api login? If so how should I handle the different requirements - inform the user of success or failure with a flash/redirect and return a JSON object to the API client?