                         eventName = eventName + "|" + req.param("steedosId").replace("@", "_").replace(".", "_")
                     events[eventName] = {}
                 req.subscriber.removeSubscriptions(events)
-                
-            res.header 'Location', "/getToken/#{req.subscriber.id}"
-            res.json {}, 201
+        
+            generateResponse req.subscriber, (result)->
+                res.json result, 200
 
         catch error
             logger.error "registerTopics failed: #{error.message}"

                            events[eventName] = {}
                        subscriber.addSubscriptions(events)

                    res.header 'Location', "/getToken/#{subscriber.id}"
                    res.json {}, if created then 201 else 200

        catch error
            logger.error "Creating token failed: #{error.message}"

                            events[eventName] = {}
                        subscriber.addSubscriptions(events)

                    generateResponse subscriber, (result)->
                        res.json result, 200

        catch error
            logger.error "Creating token failed: #{error.message}"
