Logged in via OAuth, but cannot access portal properties

93
0
08-11-2022 08:59 AM
JoeHershman
MVP Regular Contributor

After a bit of deliberation I was finally able to get the OAuth credential generation working in a net6 wpf application.  See  Challenge Handler not called in WPF I took a bit of a different approach than discussed there, shown below

 

 // Calls await ArcGISPortal.CreateAsync(new Uri(ServerUrl));
_portal = await _authenticationHelper.OpenPortalAsync();

//Done to fire the ChallengeHandler before loading anything
_= await PortalItem.CreateAsync(_portal, "itemid");

Map = new Map(new Basemap(BasemapStyle.ArcGISStreetsRelief))
{
	InitialViewpoint = ...
};

_projectsFeatureLayer = new FeatureLayer(new Uri(ProjectsShapeUrl));
_photosFeatureLayer = new FeatureLayer(new Uri(PhotoUrl));

Map.OperationalLayers.Add(_photosFeatureLayer);
Map.OperationalLayers.Add(_projectsFeatureLayer);

await Map.LoadAsync();

 

This will fire the OAuth dialog and the user logs in then everything loads and no APIKey is needed.

The issue is that even though I am logged in and can load layers without issue the _portal object does not seem to hydrate completely.  There is no PortalUser on the object, and if I try to get a license it fails saying the user cannot

JoeHershman_0-1660232833691.png

According to help

JoeHershman_1-1660232992492.png

At this point the user is authenticated because the maps have loaded, load status is Loaded.  Also if I try to get a license it fails

JoeHershman_2-1660233220567.png

Which is not true, the user does have access to a Standard Runtime license.

There is nothing I could find, beyond loading a map that would be required for initialization, as described in help.  Am I missing something?

Thanks

@MatveiStefarov 

 

0 Kudos
0 Replies