How to connect to a portal with an enterprise account?

1026
1
06-30-2017 09:09 AM
MaximilianGlas
Esri Contributor

I am familiar with using secured content in AGOL with the ArcGIS Runtime. But we also have an ArcGIS Portal installed in our company. And there we are able to log in with an enterprise account, which in fact is an active directory account.

So, when I use an AGOL account, I initialize credentials in this way:

// use the authentication manager to generate a credential for the portal
var cred = await AuthenticationManager.Current.GenerateCredentialAsync(
    new Uri(agolUrl),
    "MyAgolUserName",
    password);

// add the credential if it was generated successfully
AuthenticationManager.Current.AddCredential(cred);
‍‍‍‍‍‍‍‍

But how to do when using an enterprise account? 

// use the authentication manager to generate a credential for the portal
var cred = await AuthenticationManager.Current.GenerateCredentialAsync(
    new Uri(agolUrl),
    "abc@domain.com",
    password);

// add the credential if it was generated successfully
AuthenticationManager.Current.AddCredential(cred);
‍‍‍‍‍‍‍‍

The same, if I use "domain.com\abc" instead.

This way I got an error:

You do not have permissions to access this resource or perform this operation.

0 Kudos
1 Reply
MichaelBranscomb
Esri Frequent Contributor

Hi,

There might be a couple of ways to solve this, depending on your setup and the anticipated user workflow.

Integrated Windows Authentication (IWA):

arcgis-runtime-samples-dotnet/src/WPF/ArcGISRuntime.WPF.Samples/Samples/Security/IntegratedWindowsAu... 

OAuth (user selects Enterprise account):

arcgis-runtime-samples-dotnet/src/WPF/ArcGISRuntime.WPF.Samples/Samples/Security/OAuth at master · E... 

Those are links to the WPF samples, if you're working on Android, iOS, or UWP, you'll find equivalent samples under the same folder structure.

You can also view the code under the security TOC item on ArcGIS Runtime SDK for .NET Samples—ArcGIS Runtime SDK for .NET Samples | ArcGIS for Developers 

Cheers

Mike

0 Kudos