How to access user information

It is possible to use authentication and access user information while developing bundles and apps with map.apps for Developers.

Use the Identity Service

You can connect your map.apps for Developers project to an Identity Service. Doing this will enable you to access user information from ArcGIS Online, an ArcGIS Enterprise portal or a Keycloak instance.

To connect to an Identity Service add the following properties to the application.properties file of your map.apps for Developers project:

application.properties
# Enable the Identity Service integration
security.mode=IDENTITY

# Base URL of the Identity Service
security.login.base=https://www.example.com/identity

# This has to be the URL of the ArcGIS Online organization or
# the URL of the ArcGIS Enterprise portal
# The value must match the configuration from the Identity Service
# security.oauth.provider.arcgis.url
esri.api.arcgisPortalUrl=https://myhost.example.com/portal

# (Optional) name of the Identity Service session cookie (default: ctIDENTITY)
# The value must match the configuration from the Identity Service
security.identity.cookieName=ctIDENTITY

# (Optional) Add the Identity Service as 'trustedServer',
# so that the cookie is also sent for cross domain requests
cors.request.trustedServers=https://identity.example.com

Also you need to add the authentication bundle to your app to be able to log in and access the user information.

The following example shows the configuration to use an Identity Service running at http://localhost:8080 connected to an ArcGIS Enterprise portal while map.apps for Developers runs on http://localhost:9090.

Example
security.mode=IDENTITY
security.login.base=http://localhost:8080
# The value must match the configured portal
esri.api.arcgisPortalUrl=https://myhost.example.com/portal
# Necessary to send cookie via proxy
proxy.allowedServerUrls=http://localhost:8080/**,trusted:true;
As of security reason there will be no cookie sent when trying to connect map.apps for Developers running at http://localhost to a remote Identity Service running under HTTPS, e.g. https://identity.example.com/identity. Therefore, no authentication will be possible. To solve this, run map.apps for Developers under HTTPS as well.