Logged in via OAuth, but cannot access portal properties

08-11-2022 08:59 AM
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));


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


According to help


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


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?




0 Kudos
0 Replies