<?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: Secured resource, error 401 in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/secured-resource-error-401/m-p/1227963#M7477</link>
    <description>&lt;P&gt;Hello, sorry to hear you are having issues. &amp;nbsp;Which method(s) are you using to create the AGSFeatureLayer? &amp;nbsp;If you're using an `AGSServiceFeatureTable` to create the layer, you can simply set a credential on it, so you don't have to mess with tokens or anything else. &amp;nbsp;If the service can be authenticated on different environments, then you should be all set.&lt;/P&gt;&lt;P&gt;`AGSServiceFeatureTable` inherits from `AGSRemoteResource`. &amp;nbsp;That protocol has a `credential` property that you can use to prevent authentication challenges from being displayed to the user (provided the credential is valid for the resource you're trying to access). &amp;nbsp;All classes that inherit from `AGSRemoteResource` operate that way.&lt;/P&gt;&lt;P&gt;Give that a try and if it doesn't work I'll be more than happy to dig into it further with you.&lt;/P&gt;&lt;P&gt;-Mark&lt;/P&gt;</description>
    <pubDate>Wed, 02 Nov 2022 15:59:04 GMT</pubDate>
    <dc:creator>MarkDostal</dc:creator>
    <dc:date>2022-11-02T15:59:04Z</dc:date>
    <item>
      <title>Secured resource, error 401</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/secured-resource-error-401/m-p/1227677#M7476</link>
      <description>&lt;P&gt;I'm trying to create&amp;nbsp;AGSFeatureLayer from an URL. The resource is under authentication, so I pass a token to AGSServiceFeatureTable object using&amp;nbsp;AGSRequestConfiguration. In our project we have a couple of environments and for one of them it works fine, but for the other one i'm getting an alert:&lt;BR /&gt;"&amp;lt;NDA_domain.com&amp;gt; requires a client certificate"&lt;BR /&gt;"Would you like to browse for the certificate to connect to this host?"&lt;/P&gt;&lt;P&gt;I was also able to extract the following error using&amp;nbsp;AGSAuthenticationManagerDelegate:&lt;/P&gt;&lt;P&gt;Error Domain=com.esri.arcgis.runtime.services.error Code=401 "Credential Required" UserInfo={NSURL=https://&amp;lt;NDA_domain.com&amp;gt;/FeatureServer/4, NSLocalizedDescription=Credential Required, protectionSpace=&amp;lt;NSURLProtectionSpace: 0x600000980f10&amp;gt;: Host:&amp;lt;NDA_domain.com&amp;gt;, Server:https, Auth-Scheme:NSURLAuthenticationMethodClientCertificate, Realm:(null), Port:443, Proxy:NO, Proxy-Type:(null)}&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Other errors in console look like this:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Connection 4: TLS Client Certificates encountered error 1:89&lt;BR /&gt;&lt;BR /&gt;Connection 4: encountered error(1:89)&lt;BR /&gt;&lt;BR /&gt;[boringssl] boringssl_context_handle_fatal_alert(1967) [C4.3.1:2][0x137dd7c90] write alert, level: fatal, description: certificate unknown&lt;BR /&gt;&lt;BR /&gt;[boringssl] boringssl_context_error_print(1957) [C4.3.1:2][0x137dd7c90] Error: 5256693112:error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED:/Library/Caches/com.apple.xbs/Sources/boringssl/ssl/handshake.cc:419:&lt;/P&gt;&lt;P&gt;[boringssl] boringssl_session_handshake_incomplete(86) [C4.3.1:2][0x137dd7c90] SSL library error&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Some more details.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;When I try to load the url using URLSession, it works well every time. I'm also able to load the resource successfully in a browser (including iOS Safari). And it works well in Postman.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I try to monitor requests with proxy tools like Proxyman, for some reason the 401 error disappears.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I also tried using&amp;nbsp;AGSAuthenticationManagerDelegate, to fix the issue in&lt;BR /&gt;-&lt;SPAN&gt;authenticationManager:didReceiveAuthenticationChallenge:&lt;BR /&gt;by creating&amp;nbsp;&lt;/SPAN&gt;AGSCredential with the same auth token, but I had partial success: the didReceive&lt;SPAN&gt; challenge method keeps being invoked with the new&amp;nbsp;Code=498 "Invalid token" error and when I try to load the resource a couple more times it actually loads successfully at some point. But it's not the best result with all those errors.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;So the main questions are:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Where Auth-Scheme:NSURLAuthenticationMethodClientCertificate is coming from? And how to get rid of this Certificate authentication attempt?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 20:58:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/secured-resource-error-401/m-p/1227677#M7476</guid>
      <dc:creator>AndriyFedin</dc:creator>
      <dc:date>2022-11-01T20:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Secured resource, error 401</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/secured-resource-error-401/m-p/1227963#M7477</link>
      <description>&lt;P&gt;Hello, sorry to hear you are having issues. &amp;nbsp;Which method(s) are you using to create the AGSFeatureLayer? &amp;nbsp;If you're using an `AGSServiceFeatureTable` to create the layer, you can simply set a credential on it, so you don't have to mess with tokens or anything else. &amp;nbsp;If the service can be authenticated on different environments, then you should be all set.&lt;/P&gt;&lt;P&gt;`AGSServiceFeatureTable` inherits from `AGSRemoteResource`. &amp;nbsp;That protocol has a `credential` property that you can use to prevent authentication challenges from being displayed to the user (provided the credential is valid for the resource you're trying to access). &amp;nbsp;All classes that inherit from `AGSRemoteResource` operate that way.&lt;/P&gt;&lt;P&gt;Give that a try and if it doesn't work I'll be more than happy to dig into it further with you.&lt;/P&gt;&lt;P&gt;-Mark&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 15:59:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/secured-resource-error-401/m-p/1227963#M7477</guid>
      <dc:creator>MarkDostal</dc:creator>
      <dc:date>2022-11-02T15:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Secured resource, error 401</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/secured-resource-error-401/m-p/1228070#M7478</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Mark!&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for the answer!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Yes, I do create the layer using `AGSServiceFeatureTable.` But using `AGSCredential` doesn't work (I checked just in case) because we need authentication to our server. The server, in its turn, delivers layers to the ArcGIS SDK. So the token isn't for ArcGIS - it's for our app user account. I set it in the `userHeaders` property of `AGSRequestConfiguration` for ArcGIS to be able to load the layers.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have to update the initial details by saying that the `AGSCredential` object I use in `didReceiveAuthenticationChallenge` doesn't do anything useful. The object simply allows me to call the `continueWithCredential` function. When I set a random string to the `token` property of the object ArcGIS manages to load the resource anyway.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So to be concise:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;I try to load the layer&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;I get code 401 "Credential required" in `AGSAuthenticationManagerDelegate`&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;I set dummy credentials and call `continue`&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;I get code 200 to the layer request&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;I get code 498 exactly 7 times when layer's `/query` URL is requested&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;I get code 200 to all the following requests&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;the layer is not drawn on the map&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;I try to load the same layer or any other one&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;I get code 200 to all the following requests and the layer is drawn successfully&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;So I still can't understand where the `NSURLAuthenticationMethodClientCertificate` is from.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Why does ArcGIS fail to load the resource on the first try failing with this 401 error?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And why does it work when I set a dummy credentials object and call `continue`? Looks like the client certificate isn't required eventually.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 20:11:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/secured-resource-error-401/m-p/1228070#M7478</guid>
      <dc:creator>AndriyFedin</dc:creator>
      <dc:date>2022-11-02T20:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Secured resource, error 401</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/secured-resource-error-401/m-p/1228094#M7479</link>
      <description>&lt;P&gt;Thank you for the clarification. &amp;nbsp;I'm going to pull in a colleague familiar with the intricacies of Authentication to help out. &amp;nbsp;One of us will reply with feedback.&lt;/P&gt;&lt;P&gt;-Mark&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 21:30:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/secured-resource-error-401/m-p/1228094#M7479</guid>
      <dc:creator>MarkDostal</dc:creator>
      <dc:date>2022-11-02T21:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Secured resource, error 401</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/secured-resource-error-401/m-p/1230290#M7503</link>
      <description>&lt;P&gt;Hello Andriy Fedin,&lt;/P&gt;&lt;P&gt;Based on the error information provided, either the server or the additional security layer is engaging in the `&lt;SPAN&gt;Client Certificate&lt;/SPAN&gt;` challenge. Could you please elaborate on the security setups on your&amp;nbsp;&lt;SPAN&gt;environments&lt;/SPAN&gt;?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Error Domain=com.esri.arcgis.runtime.services.error Code=401 "Credential Required" UserInfo={NSURL=https://&amp;lt;NDA_domain.com&amp;gt;/FeatureServer/4, NSLocalizedDescription=Credential Required, protectionSpace=&amp;lt;NSURLProtectionSpace: 0x600000980f10&amp;gt;: Host:&amp;lt;NDA_domain.com&amp;gt;, Server:https, Auth-Scheme:NSURLAuthenticationMethodClientCertificate, Realm:(null), Port:443, Proxy:NO, Proxy-Type:(null)}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also, you can please create request log by setting properties on&amp;nbsp;request&amp;nbsp;configuration.&amp;nbsp;You can send the log file to me directly.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;let config = AGSRequestConfiguration.global()&lt;/P&gt;&lt;P&gt;config.debugLogFileURL = URL(fileURLWithPath: "&amp;lt;path&amp;gt;/requestLog.md")&lt;/P&gt;&lt;P&gt;config.debugLogDeleteBeforeEachRun = true&lt;/P&gt;&lt;P&gt;config.debugLogRequests = true&lt;/P&gt;&lt;P&gt;config.debugLogIncludeRequestHeaders = true&lt;/P&gt;&lt;P&gt;config.debugLogResponses = true&lt;/P&gt;&lt;P&gt;config.debugLogIncludeResponseHeaders = true&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nimesh&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2022 23:48:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/secured-resource-error-401/m-p/1230290#M7503</guid>
      <dc:creator>NimeshJarecha</dc:creator>
      <dc:date>2022-11-09T23:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: Secured resource, error 401</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/secured-resource-error-401/m-p/1238834#M7522</link>
      <description>&lt;P&gt;Hi Nimesh!&lt;BR /&gt;Thanks for your reply! Sorry I was unable to react right away.&lt;/P&gt;&lt;P&gt;We've been able to identify the issue with our backend team. An additional security layer on the backend indeed caused it. I can't provide more info, unfortunately. The debug log settings you mentioned were handy, though!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 18:00:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/secured-resource-error-401/m-p/1238834#M7522</guid>
      <dc:creator>AndriyFedin</dc:creator>
      <dc:date>2022-12-07T18:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Secured resource, error 401</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/secured-resource-error-401/m-p/1238908#M7523</link>
      <description>&lt;P&gt;Thanks for letting us know and glad you were able to track it down!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nimesh&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 21:10:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/secured-resource-error-401/m-p/1238908#M7523</guid>
      <dc:creator>NimeshJarecha</dc:creator>
      <dc:date>2022-12-07T21:10:09Z</dc:date>
    </item>
  </channel>
</rss>

