educos

How To Authenticate to access content in ArcGIS Online

Discussion created by educos on Mar 9, 2018
Latest reply on Mar 10, 2018 by educos

Hi,

I have a very simple thing to do, but I did not find any easy information to do it.

 

I have today a Xamarin app that use RuntimeSDK .NET. In this app, I have a MapView control that I initialize with a url that points to a WebMap that I created on my ArcGIS Online portal. The url is something like:

https://<myname>.maps.arcgis.com/home/webmap/viewer.html?webmap=<identifier>

As far as I share to everyone the WebMap and Featured layers that are included in my WebMap, there is no problem...

 

Now, I want to secure the access and allow only me as a user for accessing this resource.

I found that I can use this piece of code to give authentication but what to give as ServiceUrl to allow the application to acces my content ? I tried many url, but none worked...

 

var cred = await AuthenticationManager.Current.GenerateCredentialAsync(new Uri("<ServiceUrl>"), "<login>", "<password>");
AuthenticationManager.Current.AddCredential(cred);

 

Please help !!! I am a little lost with all (too many) possibilities that are described in the help, but without really samples that correspond to my needs.

 

Eric.

Outcomes