Companion example code for the Authentication in ArcGIS technical session at Esri Developer Summit 2022.
This repository has sample projects that help demonstrate some of the authentication techniques you can use with ArcGIS servers. Review the documentation at Security and authentication to learn more about the methods of authentication:
- API keys
- ArcGIS identity, or logging users in
- Application credentials
- Other authentication methods
There are 6 projects here that demonstrate 3 of the authentication methods:
-
esm-api-key-demo demonstrates using API keys with basemaps and routing services in an ArcGIS API for JavaScript browser-based application using ES modules.
-
arcgis-rest-js-auth demonstrates using ArcGIS identity with OAuth 2.0 to log a user in with ArcGIS REST JS browser-based application using Vite.
-
esm-user-login-demo demonstrates using ArcGIS identity with OAuth 2.0 to log a user in to use basemaps and routing services in an ArcGIS API for JavaScript browser-based application using ES modules.
-
nodejs-app-credential-example is an implementation of the application credentials Node.js example code shown on ArcGIS application credentials.
-
esm-app-token-demo demonstrates using ArcGIS application credentials with a back-end server and OAuth 2.0 to get an application token to use basemaps and routing services in an ArcGIS API for JavaScript browser-based application using ES modules. This project requires a running server to handle the token negotiation, and there are two options provided here:
- nodejs-app-token-server-demo is a server written with Node.js.
- php-app-token-server-demo is a server written with PHP.
The example servers are minimal implementations designed to demonstrate the necessary building blocks for such a service, but require additional security and operational considerations that are beyond the scope of this demo.