<?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: Getting 401 (Unauthorized) accessing secured service with valid credentials in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/getting-401-unauthorized-accessing-secured-service/m-p/150103#M1685</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes it's a known issue with the Android Http Handlers. They each have their pros and cons, and a lot of people are using the ModernHttpClient:&amp;nbsp;&lt;A class="link-titled" href="https://github.com/paulcbetts/modernhttpclient" title="https://github.com/paulcbetts/modernhttpclient"&gt;GitHub - paulcbetts/ModernHttpClient: HttpClient implementations that use platform-native HTTP clients for&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After adding the NuGet you can set this up like this:&lt;/P&gt;&lt;P&gt;System.Environment.SetEnvironmentVariable("XA_HTTP_CLIENT_HANDLER_TYPE", "ModernHttpClient.NativeMessageHandler,ModernHttpClient");&lt;/P&gt;&lt;P&gt;(make sure you call this prior to making any HTTP Requests)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought this was already documented, but I can't find it either, so I'll follow up with our doc people.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Nov 2018 16:46:16 GMT</pubDate>
    <dc:creator>dotMorten_esri</dc:creator>
    <dc:date>2018-11-12T16:46:16Z</dc:date>
    <item>
      <title>Getting 401 (Unauthorized) accessing secured service with valid credentials</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/getting-401-unauthorized-accessing-secured-service/m-p/150101#M1683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to access a secured ArcGIS Server MapService that uses AD authentication. I can access the service in the browser on the device with the credentials provided by the customer. Yet I'm unable to load a map as I'm always getting the following exception:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;System.Net.Http.HttpRequestException: 401 (Unauthorized)&lt;BR /&gt; at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode () [0x0002a] in &amp;lt;f26106f7890945d7922088b4caacae4a&amp;gt;:0 &lt;BR /&gt; at Esri.ArcGISRuntime.Internal.RequestRequiredHandler+&amp;lt;IssueRequestAndRespond&amp;gt;d__14.MoveNext () [0x005fd] in C:\daily_r\api_xam\dotnet\api\src\Esri.ArcGISRuntime\Esri.ArcGISRuntime.Shared\Internal\RequestRequiredHandler.cs:265 &lt;BR /&gt;--- End of stack trace from previous location where exception was thrown ---&lt;BR /&gt; at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in &amp;lt;43dbbdc147f2482093d8409abb04c233&amp;gt;:0 &lt;BR /&gt; at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in &amp;lt;43dbbdc147f2482093d8409abb04c233&amp;gt;:0 &lt;BR /&gt; at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in &amp;lt;43dbbdc147f2482093d8409abb04c233&amp;gt;:0 &lt;BR /&gt; at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in &amp;lt;43dbbdc147f2482093d8409abb04c233&amp;gt;:0 &lt;BR /&gt; at App4.MainPage+&amp;lt;InitMap&amp;gt;d__5.MoveNext () [0x00136] in C:\Users\&amp;lt;myuser&amp;gt;\source\repos\App4\App4\App4\MainPage.xaml.cs:56&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The&amp;nbsp;complete code is as follows:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;using Esri.ArcGISRuntime.Mapping;&lt;BR /&gt;using Esri.ArcGISRuntime.Security;&lt;BR /&gt;using Esri.ArcGISRuntime.Xamarin.Forms;&lt;BR /&gt;using System;&lt;BR /&gt;using System.Diagnostics;&lt;BR /&gt;using System.Net;&lt;BR /&gt;using System.Threading.Tasks;&lt;BR /&gt;using Xamarin.Forms;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;namespace App4&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; public partial class MainPage : ContentPage&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; static string ServerUrl = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2F" rel="nofollow" target="_blank"&gt;https://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;url to customer's arcgis server&amp;gt;";&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;static string layerUrl = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2F" rel="nofollow" target="_blank"&gt;https://&lt;/A&gt;&lt;SPAN&gt;&amp;lt;url to customer's arcgis server&amp;gt;/rest/services/&amp;lt;service&amp;gt;/MapServer";&lt;/SPAN&gt;&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;static string user = "&amp;lt;user&amp;gt;";&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;static string pw = "&amp;lt;password&amp;gt;";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;public MainPage()&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;InitializeComponent();&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;InitMap();&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;private async Task InitMap()&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;try&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;var mapView = new MapView();&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;var authManager = Esri.ArcGISRuntime.Security.AuthenticationManager.Current;&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;authManager.AddCredential(new ArcGISNetworkCredential()&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;Credentials = new NetworkCredential(user, pw),&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;ServiceUri = new Uri(layerUrl)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;});&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;authManager.RegisterServer(new ServerInfo { ServerUri = new Uri(ServerUrl) });&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;var map = new Map();&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;map.Basemap.BaseLayers.Add(new ArcGISMapImageLayer(new Uri(layerUrl)));&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;mapView.Map = map;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;Content = mapView;&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;await map.LoadAsync();&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;}&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;catch (Exception ex)&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;{&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;Debug.WriteLine(ex);&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;await DisplayAlert("Error", ex.ToString(), "OK");&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;}&lt;BR /&gt; &lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This happens with Runtime SDK version 100.2, 100.2.1, 100.3 and 100.4. The app itself is the default Xamarin.Forms template in Visual Studio 2017 using shared code. I'm testing on Android at the moment - can't say if it happens on all platforms.&lt;/P&gt;&lt;P&gt;The code for authentication is taken basically 1:1 from&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/net/latest/uwp/guide/use-the-authentication-manager.htm" title="https://developers.arcgis.com/net/latest/uwp/guide/use-the-authentication-manager.htm"&gt;Use the Authentication Manager—ArcGIS Runtime SDK for .NET | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;(HTTP (integrated Windows authentication) authorization)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The server is version 10.3.1, using web authentication in IIS with AD accounts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If needed I'm able to provide the URL to the service along with valid credentials.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Nov 2018 10:36:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/getting-401-unauthorized-accessing-secured-service/m-p/150101#M1683</guid>
      <dc:creator>alehmann</dc:creator>
      <dc:date>2018-11-09T10:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 401 (Unauthorized) accessing secured service with valid credentials</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/getting-401-unauthorized-accessing-secured-service/m-p/150102#M1684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay, going at it with a fresh mind helped. It seems the problem lies in the&amp;nbsp;HttpClient implementation. Using the native (Android) implementation leads to the described problem. Changing it to "managed" resolves this problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this a known problem? If so, I think it would be useful to mention it somewhere prominently as the native implementation is the default setting in VS2017.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2018 10:59:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/getting-401-unauthorized-accessing-secured-service/m-p/150102#M1684</guid>
      <dc:creator>alehmann</dc:creator>
      <dc:date>2018-11-12T10:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 401 (Unauthorized) accessing secured service with valid credentials</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/getting-401-unauthorized-accessing-secured-service/m-p/150103#M1685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes it's a known issue with the Android Http Handlers. They each have their pros and cons, and a lot of people are using the ModernHttpClient:&amp;nbsp;&lt;A class="link-titled" href="https://github.com/paulcbetts/modernhttpclient" title="https://github.com/paulcbetts/modernhttpclient"&gt;GitHub - paulcbetts/ModernHttpClient: HttpClient implementations that use platform-native HTTP clients for&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After adding the NuGet you can set this up like this:&lt;/P&gt;&lt;P&gt;System.Environment.SetEnvironmentVariable("XA_HTTP_CLIENT_HANDLER_TYPE", "ModernHttpClient.NativeMessageHandler,ModernHttpClient");&lt;/P&gt;&lt;P&gt;(make sure you call this prior to making any HTTP Requests)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I thought this was already documented, but I can't find it either, so I'll follow up with our doc people.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2018 16:46:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/getting-401-unauthorized-accessing-secured-service/m-p/150103#M1685</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2018-11-12T16:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: Getting 401 (Unauthorized) accessing secured service with valid credentials</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/getting-401-unauthorized-accessing-secured-service/m-p/150104#M1686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am running into this same problem while testing in UWP. My Android application crashes completely while trying to load the map. This is with version 100.5.0 of the .Net SDK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am first trying to load the map service layer in my map&amp;nbsp;using the&amp;nbsp;default authentication challenger and no matter which credentials I put it, it returns 401 Unauthorized.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2019 20:06:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/getting-401-unauthorized-accessing-secured-service/m-p/150104#M1686</guid>
      <dc:creator>StevenMurray1</dc:creator>
      <dc:date>2019-05-01T20:06:22Z</dc:date>
    </item>
  </channel>
</rss>

