<?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: MAUI Authentication Issues in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/maui-authentication-issues/m-p/1419658#M12675</link>
    <description>&lt;P&gt;After some additional research I found a MAUI sign in sample&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-maps-sdk-dotnet-demos/blob/35c91ff74cf2f6a23f80a60fc1a8786c4ed14f36/src/MauiSignin/StartupPage.xaml.cs#L74" target="_self"&gt;MauiSignin&lt;/A&gt;.&amp;nbsp; This includes setting&amp;nbsp; Persistence property on AuthenticationManager&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;AuthenticationManager.Current.Persistence = await CredentialPersistence.CreateDefaultAsync();&lt;/LI-CODE&gt;&lt;P&gt;Unfortunately, this did not resolve the issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still fail trying to query the service layer even though it would seem that everything is set correct and I have permissions&lt;/P&gt;</description>
    <pubDate>Mon, 06 May 2024 20:58:44 GMT</pubDate>
    <dc:creator>JoeHershman</dc:creator>
    <dc:date>2024-05-06T20:58:44Z</dc:date>
    <item>
      <title>MAUI Authentication Issues</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/maui-authentication-issues/m-p/1419610#M12673</link>
      <description>&lt;P&gt;I am migrating an app from Xamarin to Maui, currently focused on iOS.&lt;/P&gt;&lt;P&gt;I have the Authentication setup and things appear to work, however, when trying to query a service table I get what seems to be authentication issues.&amp;nbsp; I even added an extra authentication specific to the service and while I get a valid credential and add to AuthenticationManager I still get an apparent authentication error.&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;"You do not have permissions to access this resource or perform this operation."
Source: "System.Private.CoreLib"
   at Esri.ArcGISRuntime.Http.HttpDispatcher.SendAsync(HttpRequestMessage request, HandlerOptions options, CancellationToken cancellationToken)
   at Esri.ArcGISRuntime.Internal.RequestHandler.IssueRequestAndRespond(CoreRequest request)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Code&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;//I am already authenticated to AGOL, but added this for testing.  It does fire an OAuth window
//The credential is valid, I can even use the token from debugger to access service
var credential = await AuthenticationManager.Current.GenerateCredentialAsync(new Uri(_configuration.AppSettings.ProjectFeatureLayerUrl));
AuthenticationManager.Current.AddCredential(credential);

var table = new ServiceFeatureTable(new Uri(_configuration.AppSettings.ProjectFeatureLayerUrl));
await table.LoadAsync();  //THIS LINE FAILS, was added for testing

var parameters = new QueryParameters { WhereClause = $"{_configuration.AppSettings.FieldNames.TrackingStatus} ='Project Created'", ReturnGeometry = true, MaxFeatures = 1000 };

var results = await table.QueryFeaturesAsync(parameters, QueryFeatureFields.LoadAll);  //If does have the LoadAsync this fails&lt;/LI-CODE&gt;&lt;P&gt;As noted:&amp;nbsp; In the debugger I can grab the token and use in a browser to access that service, so it seems I am getting a valid credential.&amp;nbsp; It seems though, that the AuthenticationManager is not being queried for credentials.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;-Joe&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2024 19:25:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/maui-authentication-issues/m-p/1419610#M12673</guid>
      <dc:creator>JoeHershman</dc:creator>
      <dc:date>2024-05-06T19:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: MAUI Authentication Issues</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/maui-authentication-issues/m-p/1419658#M12675</link>
      <description>&lt;P&gt;After some additional research I found a MAUI sign in sample&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-maps-sdk-dotnet-demos/blob/35c91ff74cf2f6a23f80a60fc1a8786c4ed14f36/src/MauiSignin/StartupPage.xaml.cs#L74" target="_self"&gt;MauiSignin&lt;/A&gt;.&amp;nbsp; This includes setting&amp;nbsp; Persistence property on AuthenticationManager&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;AuthenticationManager.Current.Persistence = await CredentialPersistence.CreateDefaultAsync();&lt;/LI-CODE&gt;&lt;P&gt;Unfortunately, this did not resolve the issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still fail trying to query the service layer even though it would seem that everything is set correct and I have permissions&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2024 20:58:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/maui-authentication-issues/m-p/1419658#M12675</guid>
      <dc:creator>JoeHershman</dc:creator>
      <dc:date>2024-05-06T20:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: MAUI Authentication Issues</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/maui-authentication-issues/m-p/1419671#M12676</link>
      <description>&lt;P&gt;It seem the error is because in my Maui startup I was setting a default API key&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;.UseArcGISRuntime(config =&amp;gt; config.UseApiKey("API KEY"));&lt;/LI-CODE&gt;&lt;P&gt;Replaced with:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;.UseArcGISRuntime();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;And now it works.&amp;nbsp; Not sure why, but remove the default key has resolved the issue&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2024 21:28:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/maui-authentication-issues/m-p/1419671#M12676</guid>
      <dc:creator>JoeHershman</dc:creator>
      <dc:date>2024-05-06T21:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: MAUI Authentication Issues</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/maui-authentication-issues/m-p/1419969#M12677</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;Not sure why, but remove the default key has resolved the issue&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If you set a default API Key, it will be used for all requests so even if you configure OAuth, the OAuth/Authentication Manager workflows won't be kicked off.&lt;/P&gt;&lt;P&gt;By no longer setting it, the SDK will interrogate services and any auth config you've set up and use that info to manage authentication. If you need API Keys for specific services, you can still set them directly on those SDK objects (just not globally) and use a mix of API Key and OAuth authentication.&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2024 16:19:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/maui-authentication-issues/m-p/1419969#M12677</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2024-05-07T16:19:02Z</dc:date>
    </item>
  </channel>
</rss>

