Configure OAuth 2.0 (Modes Panel UI)
Learn how configure OAuth 2.0 and load private layers. When your app requires access to private content in the ArcGIS Platform, you should implement OAuth 2.0 to obtain an ArcGIS identity (previously called a named user login). This allows individual users to authorize your app to use the content and services to which the user has been granted access.
In this tutorial, you will learn how to configure OAuth 2.0 by using the Modes Panel.
Before starting this tutorial, you should:
- Have an ArcGIS account, and have a set of Client ID and Redirect URI for your ArcGIS identity to access a private layer. If you don't have an account, sign up for free.
- Ensure your development environment meets the system requirements.
- Take Install and setup steps, and create a new project, and choose the Details Panel as your scene setting option.
- Make either Global scene or Local scene.
- Add a private layer.
The Modes Panel has the sample OAuth challenge handler initializer in the source code. In the Auth section, you can add an Authentication Configuration for each private service in the Authentication Configuration section.
Click the Auth tab and open the Authentication Configuration section.
Se the Configuration Name.
Enter the Client ID and Redirect URI for your app.
Click the Add button. You can find the new configuration in the Authentication Configurations section.
Click on the Layers tab and open the Layers subsection.
Open the index where you have the private layer.
Click the Authentication Configuration dropdown and select your configuration.
When the private layer starts to load in the editor Viewport, it will display the sign in window in a pop-up.
The Modes Panel UI has the OAuth challenge handler that works for the editor mode only. For the play mode, attach an OAuth challenge handler to the ArcGIS Map Actor. In this tutorial, you will attach the Sample OAuth Authentication Challenge Handler Component in the following location to the ArcGIS Map Actor.
Plugins > ArcGIS Maps SDK for Unreal Engine C++Classes > ArcGISSamples > Private > Security
Click on the ArcGIS Map Actor in the Outliner panel.
In the Details panel, click on the + Add icon.
Search the Sample OAuth Authentication Challenge Handler Component and click to attach it to the Actor.
The Sample OAuth Authentication Challenge Handler will use the configuration when you click Play and display the pop-up window when the private layer starts to load in the Viewport.