Select to view content in your preferred language

.NET Maui - Private FeatureLayer not showing on esri map after being added

648
2
07-05-2023 06:30 AM
Labels (5)
cdirth
by
New Contributor

Hi all,
I am having troubles having my FeatureLayer show on my esri map after being added to the OperationalLayers of my map control. I am using the ArcGIS .NET SDK for .NET Maui, and OAuth 2.0 for Authentication and passing the token as a parameter for all private layers. Testing not working on iOS and Android.

My current flow is as follows:

  1. Open Map Custom Layer Picker Toggles
  2. Choose a Layer
  3. Choosing a Layer prompts our app to open a web view, to which we load the authorization url + redirect uri (as mentioned here)
  4. Following a successful login, close the window after receiving and parsing out the auth token
  5. Add the layer (in this case its a FeatureLayer) with the token in the Uri, to the map view's OperationalLayers
  6. Zooming into all data areas of the FeatureLayer does not show any (polyline) data plotted on the map

 

Ive checked numerous things but I am stuck; subscribing to the LoadStatusChanged event shows that the layer is successfully loading, and we are still receiving the layer data, so it does not seem to be an Auth issue. Also, we have an implementation on Xamarin and we work in a very similar way (only difference is loading the FeatureLayer with a [ArcGISTokenCredential w/ a token]) and it is showing on the map.

Am I doing something wrong that the FeatureLayer isn't working despite the layer being Loaded with no errors? Is there are a required or suggested alternative method for handling the token? I have seen other threads mentioning to pass the token as a Auth header, but those methods didn't seem to work. All help is appreciated, thanks!

0 Kudos
2 Replies
JoeHershman
MVP Regular Contributor

If you follow the OAuth implementation pattern there is no need to include a token in the Url.  Including this may in be the issue.

When the app requests a secure service from the server AuthenticationManager will provide any required tokens.

Thanks,
-Joe
RodBall
New Contributor

Still having the same issue. I implemented the AuthenticationManager flow listed and it's still not working. Is there a special way to register the tokens, besides "AuthenticationManager.Current.AddCredential"? Additionally, is there a checklist to see if the feature layer data should be displaying on the map, or is it really so easy as:
1) Challenge and prompt login
2) Get credentials from prompt after successful login
3) Add credential to AuthenticationManager.Current via "AddCredentials"
4) Load FeatureLayer with service uri
5) Add to Operational Layers

Note*: I have correctly gotten a "Loaded" state when attaching the "LoadStatusChanged" event. I am able to access the uri with the token in the address, so why is it still not showing on the map when I zoom in to said location?

0 Kudos