Skip to content

Adding resources from devsummit europe 22 #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 34 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
# Authentication in ArcGIS

Companion example code for the [Authentication in ArcGIS technical session](https://www.esri.com/en-us/about/events/devsummit/agenda/agenda/detail?date=2022-03-09) 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](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/) to learn more about the methods of authentication:

- [API keys](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/api-keys/)
- [ArcGIS identity](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/arcgis-identity/), or logging users in
- [Application credentials](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/application-credentials/)
- [Other authentication methods](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/arcgis-identity/other-authentication-methods/)

There are 6 projects here that demonstrate 3 of the authentication methods:

- [esm-api-key-demo](./esm-api-key-demo/README.md) demonstrates using [API keys](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/api-keys/) with basemaps and routing services in an [ArcGIS API for JavaScript](https://developers.arcgis.com/javascript/) browser-based application using ES modules.
- [arcgis-rest-js-auth](./arcgis-rest-js-auth/README.md) demonstrates using [ArcGIS identity](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/arcgis-identity/) with OAuth 2.0 to log a user in with [ArcGIS REST JS](https://developers.arcgis.com/arcgis-rest-js/) browser-based application using Vite.
- [esm-user-login-demo](./esm-user-login-demo/README.md) demonstrates using [ArcGIS identity](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/arcgis-identity/) with OAuth 2.0 to log a user in to use basemaps and routing services in an [ArcGIS API for JavaScript](https://developers.arcgis.com/javascript/) browser-based application using ES modules.
- [nodejs-app-credential-example](./nodejs-app-credential-example/README.md) is an implementation of the application credentials Node.js example code shown on [ArcGIS application credentials](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/application-credentials/).
- [esm-app-token-demo](./esm-app-token-demo/README.md) demonstrates using [ArcGIS application credentials](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/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](https://developers.arcgis.com/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](./nodejs-app-token-server-demo/README.md) is a server written with Node.js.
- [php-app-token-server-demo](./nodejs-app-token-server-demo/README.md) 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.

## Additional resources

* [Developers.arcgis.com](https://developers.arcgis.com/)
* [Security and Authentication](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/)
* [Esri community developer questions](https://community.esri.com/t5/developers-questions/bd-p/developers-questions)
* [ArcGIS API for JavaScript](https://developers.arcgis.com/javascript/latest/authenticate-with-an-arcgis-identity/)
* [ArcGIS Runtime APIs](https://developers.arcgis.com/net/security-and-authentication/)
* [ArcGIS API for Python](https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/)
* [ArcGIS REST JS](https://developers.arcgis.com/arcgis-rest-js/authenticate/authenticate-with-an-arcgis-identity-rest-js-browser/)
We produce technical talks at Esri Developer Summit every year to explain what's new about how to authenticate in ArcGIS plus we use different approaches. On this repo you will find all these resources.

## Related talks

|Developer Summit Edition|Session|
|---|---|
|DevSummit Europe 2022|[Authentication in ArcGIS: A Practical Approach](./devsummit-europe-22)|
|DevSummit USA 2022|[Authentication in ArcGIS](./devsummit-usa-22)|


## Resources

* [Security and Authentication conceptual guide](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/)
* [Authentication in ArcGIS workspace | Postman workspace](https://www.postman.com/arcgis-developer/workspace/3e1be892-6475-4b95-b880-d713856e4180/overview)
* [Esri community developer questions](https://community.esri.com/t5/forums/tagdetailpage/tag-cloud-grouping/message/tag-cloud-style/frequent/message-scope/core-node/board-id/arcgis-rest-api-questions/user-scope/all/tag-scope/single/tag-id/3197/timerange/all/tag-visibility-scope/public)
* REST API endpoints:
* [/oauth2/registerApp](https://developers.arcgis.com/rest/users-groups-and-items/register-app.htm)
* [/oauth2/authorize](https://developers.arcgis.com/rest/users-groups-and-items/authorize.htm)
* [/oauth2/revokeToken](https://developers.arcgis.com/rest/users-groups-and-items/revoke-token.htm)
* [/oauth2/token](https://developers.arcgis.com/rest/users-groups-and-items/token.htm)
* [/generateToken](https://developers.arcgis.com/rest/users-groups-and-items/generate-token.htm)
* ArcGIS Maps SDKs guides:
* ArcGIS Web SDKs: [ArcGIS Maps SDK for JavaScript > Authenticate with ArcGIS Identity](https://developers.arcgis.com/javascript/latest/authenticate-with-an-arcgis-identity/), [Leaflet](https://developers.arcgis.com/esri-leaflet/authentication/apikeys/), [MapLibre GL JS](https://developers.arcgis.com/maplibre-gl-js/authentication/apikeys/), [OpenLayers](https://developers.arcgis.com/openlayers/authentication/apikeys/).
* ArcGIS Native SDKs | Security and authentication: [Android](https://developers.arcgis.com/android/security-and-authentication/), [.NET](https://developers.arcgis.com/net/security-and-authentication/), [Qt](https://developers.arcgis.com/qt/security-and-authentication/), [iOS](https://developers.arcgis.com/ios/security-and-authentication/), [Java](https://developers.arcgis.com/java/security-and-authentication/)...
* ArcGIS Game Engine SDKs: [Unity](https://developers.arcgis.com/unity/authentication/), [Unreal engine](https://developers.arcgis.com/unreal-engine/authentication/)
* Scripting and automation guides:
* [ArcGIS API for Python | Working with different authentication schemes](https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/)
* [Python: API key manager class](https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#apikeymanager) (creates, manages and updates API keys)
* [ArcGIS REST JS | Authentication](https://developers.arcgis.com/arcgis-rest-js/authentication/)
* Other samples:
* [PHP and JavaScript/Node OAuth code samples](https://github.com/esri-es/arcgis-oauth-samples)
* Find more samples in the DevSummit sessions folder
* [Get API key usage statistics | Using Python](https://github.com/esrinederland/CoolScripts/tree/main/BillingAPI)
* [How to create an API key tutorial](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/tutorials/create-and-manage-an-api-key/)
30 changes: 30 additions & 0 deletions devsummit-europe-22/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Authentication in ArcGIS: A Practical Approach

> Developer Summit Berlin - November 2022

Two main authentication mechanisms exist for applications built with ArcGIS services. API keys allow quick access to popular locations services such as basemaps, routing and geocoding, and ArcGIS Identities provide access to private user and organization content for richer experiences. This session will cover the key differences and use cases between these approaches and how to integrate each into your applications.

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [Recording](#recording)
- [Slides](#slides)
- [Sample code](#sample-code)


<!-- END doctoc generated TOC please keep comment here to allow auto update -->

---

## Recording

N.A.

## Slides

Soon (if not added, feel free to open an issue requesting it)

## Sample code

* [OAuth 2.0 snippet for the ArcGIS Maps SDK for JavaScript](./jsapi-oauth2-snippet)
32 changes: 32 additions & 0 deletions devsummit-europe-22/jsapi-oauth2-snippet/jspi_oauth2_snippet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const portalLogin = async (): Promise<void> => {
const oAuthInfo = new OAuthInfo({
appId: <appId>,
portalUrl: <arcgisServer> + endpoints.portal,
popup: false,
});

portal = new Portal({
url: <arcgisServer> + endpoints.portal,
});
await portal.load();

IdentityManager.registerOAuthInfos([oAuthInfo]);

try {
const signInEvt: Credential = await IdentityManager.checkSignInStatus(
`${oAuthInfo.portalUrl}${endpoints.sharing}`
);
userId = signInEvt.userId;
storeCredentialsInApp({ portal: portal, userId: userId });
} catch (error) {
console.error(error.message);
const signInEvt: Credential = await IdentityManager.getCredential(
`${oAuthInfo.portalUrl}${endpoints.sharing}`,
{
oAuthPopupConfirmation: false,
}
);
userId = signInEvt.userId;
storeCredentialsInApp({ portal: portal, userId: userId });
}
};
62 changes: 62 additions & 0 deletions devsummit-usa-22/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Authentication in ArcGIS

> Developer Summit Palm Springs - March 2022


Two main authentication mechanisms exist for applications built with ArcGIS services. API keys allow quick access to popular locations services such as basemaps, routing and geocoding, and ArcGIS Identities provide access to private user and organization content for richer experiences. This session will cover the key differences and use cases between these approaches and how to integrate each into your applications

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [Recording](#recording)
- [Slides](#slides)
- [Sample code](#sample-code)
- [Additional resources](#additional-resources)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

---

## Recording

[Watch the recording](https://mediaspace.esri.com/playlist/dedicated/259237542/1_gqom4ry7/1_gnry42em):

[![Talk thumbnail](https://cfvod.kaltura.com/p/3057483/sp/305748300/thumbnail/entry_id/1_gnry42em/version/100001/width/478/height/269/width/478/height/269/type/3/quality/100)](https://mediaspace.esri.com/playlist/dedicated/259237542/1_gqom4ry7/1_gnry42em)

## Slides
[Download the slides on PDF](https://static.rainfocus.com/esri/epcds/sess/1645210562162001juHB/SPDF/13912-authentication-in-arcgis_16488378275660015E0z.pdf)

## Sample code

Companion example code for the [Authentication in ArcGIS technical session](https://web.archive.org/web/20220308162553/https://www.esri.com/en-us/about/events/devsummit/agenda/agenda/detail?date=2022-03-09) 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](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/) to learn more about the methods of authentication:

- [API keys](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/api-keys/)
- [ArcGIS identity](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/arcgis-identity/), or logging users in
- [Application credentials](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/application-credentials/)
- [Other authentication methods](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/arcgis-identity/other-authentication-methods/)

There are 6 projects here that demonstrate 3 of the authentication methods:

- [esm-api-key-demo](./esm-api-key-demo/README.md) demonstrates using [API keys](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/api-keys/) with basemaps and routing services in an [ArcGIS API for JavaScript](https://developers.arcgis.com/javascript/) browser-based application using ES modules.
- [arcgis-rest-js-auth](./arcgis-rest-js-auth/README.md) demonstrates using [ArcGIS identity](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/arcgis-identity/) with OAuth 2.0 to log a user in with [ArcGIS REST JS](https://developers.arcgis.com/arcgis-rest-js/) browser-based application using Vite.
- [esm-user-login-demo](./esm-user-login-demo/README.md) demonstrates using [ArcGIS identity](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/arcgis-identity/) with OAuth 2.0 to log a user in to use basemaps and routing services in an [ArcGIS API for JavaScript](https://developers.arcgis.com/javascript/) browser-based application using ES modules.
- [nodejs-app-credential-example](./nodejs-app-credential-example/README.md) is an implementation of the application credentials Node.js example code shown on [ArcGIS application credentials](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/application-credentials/).
- [esm-app-token-demo](./esm-app-token-demo/README.md) demonstrates using [ArcGIS application credentials](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/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](https://developers.arcgis.com/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](./nodejs-app-token-server-demo/README.md) is a server written with Node.js.
- [php-app-token-server-demo](./nodejs-app-token-server-demo/README.md) 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.

## Additional resources

* [Developers.arcgis.com](https://developers.arcgis.com/)
* [Security and Authentication](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/)
* [Esri community developer questions](https://community.esri.com/t5/developers-questions/bd-p/developers-questions)
* [ArcGIS API for JavaScript](https://developers.arcgis.com/javascript/latest/authenticate-with-an-arcgis-identity/)
* [ArcGIS Runtime APIs](https://developers.arcgis.com/net/security-and-authentication/)
* [ArcGIS API for Python](https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/)
* [ArcGIS REST JS](https://developers.arcgis.com/arcgis-rest-js/authenticate/authenticate-with-an-arcgis-identity-rest-js-browser/)
File renamed without changes.
File renamed without changes.
File renamed without changes.