AnsweredAssumed Answered

Sync upload errors when using token authentication

Question asked by mikedmanak on Dec 16, 2015
Latest reply on Jan 27, 2016 by DGoyal-esristaff

We are migrating a mobile app to client infrastructure.  The are requiring us to use a pre-generated token to access secured feature services.  No big deal, we wire up the AGSCredential object to use the provided token.  Download and test sync (with no data) works fine.


We are seeing an issue when uploading new data to sync.  It appears that the token is not being sent along with the data to the feature service's upload endpoint.  The error we are seeing is like this:

Error Domain=NSCocoaErrorDomain Code=401 "Empty username/password" UserInfo={NSURL=https://url.for.server/path/to/service/ServiceName/FeatureServer/uploads/randomUUID/uploadPart, NSLocalizedDescription=Empty username/password}


This is the same error we see when the token isn't set correctly, or the referrer URL isn't set.  Makes me think the token from the credential isn't being sent along with the upload.  I've checked the token and referrer in chrome and I can access the upload endpoint from there


This thread from over in .NET land would seem to confirm my suspicion:

GeodatabaseSyncTask + token


Divesh Goyal

Matt Cooper