component extends="taffy.core.resource" taffy_uri="/authenticate" { public function post(username, password, deviceId) { //implementation of verifying the username/password are up to you... var authSuccess = authenticate(username, password); if (!authSuccess){ return noData().withStatus(401, "Not Authorized"); } //create a new device token: var deviceToken = createUUID(); //saving the device token to the database is up to you... saveDeviceToken(username, deviceId, deviceToken); //tell the device auth was successful and give it the device token return representationOf({ token: deviceToken }).withStatus(200, "OK"); } private function authenticate(username, password){ return true; } private function saveDeviceToken(username, deviceId, deviceToken){} }