ArcGIS Blog

Developers

ArcGIS Location Platform

Introducing Two Authentication Options in Open Source Developer Guides

By Sheryl Tania

We’re excited to announce an enhancement to our tutorials in the open-source developer guides! The tutorials now support two authentication options: API key authentication and user authentication. This update gives you the flexibility to choose the authentication method that best suits your application and security needs.  

In this blog post, we’ll walk you through the details of both options and what they mean for your development experience. 

Option 1: API key authentication

The first option is API key authentication. In the tutorial, you use an API key to authenticate requests to ArcGIS content, services, and resources. The demo app at the top of the tutorial opens directly in your browser and is ready for you to interact with. You can also view and modify the demo app’s code in CodePen 

How to get started 

  • Go to any tutorial for Esri Leaflet, OpenLayers, MapLibre GL JS, CesiumJS, or ArcGIS REST JS.
  • At the top of the tutorial, select “API key authentication.”  
  • Set up a CodePen project to access location services. 
  • Create an API key with the appropriate privileges in your ArcGIS account. 
  • Use the API key to access ArcGIS content, services, and resources. 
  • Run the app in CodePen. 

This option is ideal if you’re new to ArcGIS and location services. If you’re simply looking for a complete solution of the tutorial, go to the “API key authentication” link under Solutions. 

Option 2: User authentication

The second option is user authentication. In the tutorial, you will use OAuth credentials to create a sign-in experience for the app users. The app will access ArcGIS content, services, and resources on their behalf. When you click Start demo on the demo app at the top of the tutorial, you will be prompted to sign in with your ArcGIS account credentials. Once authenticated, you will be able to view the demo app and interact with it.  Unlike API key authentication, you won’t be able to view or modify the demo app’s code in CodePen. 

How to get started 

  • Go to any tutorial for Esri Leaflet, OpenLayers, MapLibre GL JS, CesiumJS, or ArcGIS REST JS. 
  • At the top of the tutorial, select “User authentication.”  
  • Download the starter app containing the user authentication logic and unzip it. 
  • Create OAuth credentials in your ArcGIS account. 
  • Use the OAuth credentials in your app to access ArcGIS content, services, and resources. 
  • Run the app on your local machine. 

This option is ideal if you want your app to remain private and maintain control over who can access it. If you’re simply looking for a complete solution of the tutorial, click “User authentication” under Solutions. 

So, what’s the difference? 

Here’s a quick summary of the differences between the two authentication methods: 

If you choose API key authentication in the tutorial, you will: 

  • Create an API key credential in your portal. 
  • Run the app in CodePen (or any other online code editor). 
  • Skip the sign-in process to run the demo app. 
  • View the tutorial solution in a pen format on CodePen. 

If you choose user authentication in the tutorial, you will: 

  • Create an OAuth 2.0 credential in your portal. 
  • Run the app in your local IDE, such as Visual Studio Code. 
  • Sign in to view and interact with the demo app. 
  • Download the tutorial solution in a zip format. 

The good news? No matter which option you choose, you’ll be able to access the same location services and achieve the same results. Pick the method that works best for you and start building! 

We want your feedback!  

Please take our survey to let us know if the tutorials were helpful and how we can improve them. Happy coding! 

Share this article

Subscribe
Notify of
0 Comments
Oldest
Newest
Inline Feedbacks
View all comments