<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Sync upload errors when using token authentication in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718663#M6413</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am assuming that you are passing this credential object with each request you are making. Is it possible for you to check if the token is actually being passed when you do a sync request with changes? Using something like &lt;A href="https://www.charlesproxy.com/"&gt;Charles&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Jan 2016 19:17:58 GMT</pubDate>
    <dc:creator>GagandeepSingh</dc:creator>
    <dc:date>2016-01-19T19:17:58Z</dc:date>
    <item>
      <title>Sync upload errors when using token authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718660#M6410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We are migrating a mobile app to client infrastructure.&amp;nbsp; The are requiring us to use a pre-generated token to access secured feature services.&amp;nbsp; No big deal, we wire up the AGSCredential object to use the provided token.&amp;nbsp; Download and test sync (with no data) works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are seeing an issue when uploading new data to sync.&amp;nbsp; It appears that the token is not being sent along with the data to the feature service's upload endpoint.&amp;nbsp; The error we are seeing is like this:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Error Domain=NSCocoaErrorDomain Code=401 "Empty username/password" UserInfo={NSURL=&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Furl.for.server%2Fpath%2Fto%2Fservice%2FServiceName%2FFeatureServer%2Fuploads%2FrandomUUID%2FuploadPart" rel="nofollow" target="_blank"&gt;https://url.for.server/path/to/service/ServiceName/FeatureServer/uploads/randomUUID/uploadPart&lt;/A&gt;&lt;SPAN&gt;, NSLocalizedDescription=Empty username/password}&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the same error we see when the token isn't set correctly, or the referrer URL isn't set.&amp;nbsp; Makes me think the token from the credential isn't being sent along with the upload.&amp;nbsp; I've checked the token and referrer in chrome and I can access the upload endpoint from there&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This thread from over in .NET land would seem to confirm my suspicion:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/message/546056"&gt;GeodatabaseSyncTask + token&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3289"&gt;Divesh Goyal&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/4325"&gt;Matt Cooper&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Dec 2015 00:10:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718660#M6410</guid>
      <dc:creator>MichaelDavis3</dc:creator>
      <dc:date>2015-12-17T00:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Sync upload errors when using token authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718661#M6411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you explicitly setting the token on the sync task?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2016 18:20:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718661#M6411</guid>
      <dc:creator>GagandeepSingh</dc:creator>
      <dc:date>2016-01-19T18:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sync upload errors when using token authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718662#M6412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gagandeep - thanks for jumping in on this one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using an AGSCredential object created using the following&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 11px; font-family: Menlo;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #4f8187;"&gt;appDelegate&lt;/SPAN&gt;.&lt;SPAN style="color: #4f8187;"&gt;mapCredential&lt;/SPAN&gt; = [[&lt;SPAN style="color: #703daa;"&gt;AGSCredential&lt;/SPAN&gt; &lt;SPAN style="color: #3d1d81;"&gt;alloc&lt;/SPAN&gt;] &lt;SPAN style="color: #3d1d81;"&gt;initWithToken&lt;/SPAN&gt;:serviceToken &lt;SPAN style="color: #3d1d81;"&gt;referer&lt;/SPAN&gt;:&lt;SPAN style="color: #78492a;"&gt;kFeatureServiceURL&lt;/SPAN&gt;];&lt;/P&gt;&lt;P style="font-size: 11px; font-family: Menlo; color: #3d1d81;"&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;/SPAN&gt;&lt;SPAN style="color: #4f8187;"&gt;appDelegate&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #4f8187;"&gt;mapCredential&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;setAuthType&lt;SPAN style="color: #000000;"&gt;:&lt;/SPAN&gt;AGSAuthenticationTypeToken&lt;SPAN style="color: #000000;"&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11px; font-family: Menlo; color: #3d1d81;"&gt;&lt;/P&gt;&lt;P&gt;Where servcieToken is a valid token and kFeatureServiceURL is the URL to the feature service rest endpoint.&lt;/P&gt;&lt;P&gt;As I mentioned above, this is sufficient to download an offline database, and sync the database with no new data present.&amp;nbsp; It errors out and fails when trying to upload new data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AGSCredentials created with a username and password do not have this issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2016 18:56:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718662#M6412</guid>
      <dc:creator>MichaelDavis3</dc:creator>
      <dc:date>2016-01-19T18:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sync upload errors when using token authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718663#M6413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am assuming that you are passing this credential object with each request you are making. Is it possible for you to check if the token is actually being passed when you do a sync request with changes? Using something like &lt;A href="https://www.charlesproxy.com/"&gt;Charles&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2016 19:17:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718663#M6413</guid>
      <dc:creator>GagandeepSingh</dc:creator>
      <dc:date>2016-01-19T19:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Sync upload errors when using token authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718664#M6414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's right - I'm using that AGSCredentials object with my sync task&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #bb2ca2;"&gt;self&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #4f8187;"&gt;gdbTask&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; = [[&lt;/SPAN&gt;&lt;SPAN style="color: #703daa;"&gt;AGSGDBSyncTask&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;alloc&lt;SPAN style="color: #000000;"&gt;]&lt;/SPAN&gt;initWithURL&lt;SPAN style="color: #000000;"&gt;:[&lt;/SPAN&gt;&lt;SPAN style="color: #703daa;"&gt;NSURL&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;URLWithString&lt;SPAN style="color: #000000;"&gt;:&lt;/SPAN&gt;&lt;SPAN style="color: #78492a;"&gt;kFeatureServiceURL&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;]&lt;/SPAN&gt;credential&lt;SPAN style="color: #000000;"&gt;:&lt;/SPAN&gt;&lt;SPAN style="color: #4f8187;"&gt;appDelegate&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #4f8187;"&gt;mapCredential&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;When I initially implemented this method I turned off all security so I could see the token being passed when the database was requested and synced.&amp;nbsp; I'll double check to see if it is being passed in the upload task.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2016 19:30:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718664#M6414</guid>
      <dc:creator>MichaelDavis3</dc:creator>
      <dc:date>2016-01-19T19:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Sync upload errors when using token authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718665#M6415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I turned off security and tested an upload with Charles running - it looks like the token is being sent. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's what Charles sees:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fpath.to.server%2Farcgis%2Frest%2Fservices%2FAlaska%2FADFG_Subsistence%2FFeatureServer%2Fuploads%2Fi2e0c73b3-f571-4816-8039-9c2f64c79bb6%2FuploadPart%3Ftoken%3DvalidTokenIJustCreated" rel="nofollow" target="_blank"&gt;http://path.to.server/arcgis/rest/services/Alaska/ADFG_Subsistence/FeatureServer/uploads/i2e0c73b3-f571-4816-8039-9c2f64c79bb6/uploadPart?token=validTokenIJustCreated&lt;/A&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the token is being sent but for some reason it is not authenticating correctly when used with the uploadPart endpoint.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2016 20:32:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718665#M6415</guid>
      <dc:creator>MichaelDavis3</dc:creator>
      <dc:date>2016-01-19T20:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: Sync upload errors when using token authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718666#M6416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmm looking at the requests being sent it appears that when I sync with new data it: &lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Registers the upload database with the upload task (this is correctly showing the token as one of the request variables)&lt;/LI&gt;&lt;LI&gt;Attempts to upload a geodatabase part.&amp;nbsp; This task includes the token in the URL, but it is not appearing as a request variable... the only variables that show up are the format (JSON), partID (0), and file name (longGUID_0.geodatabase)&lt;/LI&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2016 22:05:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718666#M6416</guid>
      <dc:creator>MichaelDavis3</dc:creator>
      <dc:date>2016-01-19T22:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Sync upload errors when using token authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718667#M6417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think we figured out the issue.&amp;nbsp; For all the geodatabase tasks the system dutifully uses the token and referer as defined when initializing the AGSCredential&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;EXCEPT &lt;/EM&gt;the uploadPart task&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uploadPart seems to be hard coding in a referer of "arcgisios".&amp;nbsp; This of course is not the referer used to generate the token so the request fails.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If we re-generate the token to use the magic word (arcgisios) as the referer the whole thing works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm guessing this is a left over hard-coded value from development or something, maybe something that can be fixed with an update?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2016 23:32:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718667#M6417</guid>
      <dc:creator>MichaelDavis3</dc:creator>
      <dc:date>2016-01-19T23:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sync upload errors when using token authentication</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718668#M6418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;uh-oh. We'll fix this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jan 2016 00:21:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/sync-upload-errors-when-using-token-authentication/m-p/718668#M6418</guid>
      <dc:creator>DiveshGoyal</dc:creator>
      <dc:date>2016-01-28T00:21:27Z</dc:date>
    </item>
  </channel>
</rss>

