We have build an automated AGOL web map publishing tool that creates web maps with non-hosted, credential-embedded FeatureLayers that all point to a single service. Each unique web maps adds the layers with a query string parameter, e.g. the webmap JSON layers definition looks like:
"operationalLayers" : [{
"id" : "Event_Collector_0",
"layerType" : "ArcGISFeatureLayer",
"url" : "https://utility.arcgis.com/usrsvcs/servers/33b430edb78b4b888933dd93b63309a0/rest/services/IMT/Event_...?extraParameter=foo",
"visibility" : true,
"opacity" : 1,
"mode" : 1,
"title" : "Event_Collector - Event Point",
"itemId" : "33b430edb78b4b888933dd93b63309a0",
"layerDefinition" : null
}, ...]
This way, all edits performed on these webmaps appear at the destination server with their unique extra query string parameter (or POST body element), in this case "extraParameter": "foo". We use a SOI on the destination server to manipulate the data based on this parameter. This system works very well for almost all REST operations (query, applyEdits, createReplica, etc.) but Collector will not perform a syncronizeReplica operation with replicas it has created. Instead it performs an unregisterReplica and uploads a new replica, and pops up a sign in dialog that does not successfully sign in (since we've embedded credentials in the AGOL feature service, you shouldn't have to log in anyway).
My best guess as to what's happening is that Collector is not recognizing replicas that do not fit a predefined url pattern, i.e. the query string is making it think the replica is invalid. If I publish the map without any query string, Collector works normally and syncs just fine. Any ideas out there?