Authenticate with OAuth
Authenticate with ArcGIS Online (or your own portal) using OAuth2 to access secured resources (such as private web maps or layers).
Your app may need to access items that are only shared with authorized users. For example, your organization may host private data layers or feature services that are only accessible to verified users. You may also need to take advantage of premium ArcGIS Online services, such as geocoding or routing services, which require a named user login.
When you run the sample, the app will load a web map which contains premium content. You will be challenged for an ArcGIS Online login to view the private layers. Enter a user name and password for an ArcGIS Online named user account (such as your ArcGIS for Developers account). If you authenticate successfully, the traffic layer will display, otherwise the map will contain only the public basemap layer.
- Set the
- Create a
ServerInfospecifying the portal URL, client ID, and redirect URL.
- Register the server with the authentication manager.
- Load a map with premium content requiring authentication to automatically invoke the authentication handler.
The workflow presented in this sample works for most SAML based enterprise (IWA, PKI, Okta, etc.) & social (facebook, google, etc.) identity providers for ArcGIS Online or Portal. For more information click here.
On UWP, some authentication workflows that don't support
WebAuthenticationBroker may require a custom
For additional information on using Oauth in your app, see the Mobile and Native Named User Login topic in our guide.
authentication, cloud, credential, OAuth, OAuth2, portal, security
<UserControl x:Class="ArcGISRuntime.WPF.Samples.OAuth.OAuth" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"> <Grid> <esri:MapView x:Name="MyMapView"/> </Grid> </UserControl>