I am migrating an app from Xamarin to Maui, currently focused on iOS.
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. 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.
Error:
"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)
Code
//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
As noted: 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. It seems though, that the AuthenticationManager is not being queried for credentials.
Thanks
-Joe
Thanks,
-Joe