Skip to content
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

feat: make API keys work with all portal methods #1186

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

patrickarlt
Copy link
Contributor

This should do all of the work to resolve #1182.

There should be no breaking changes because of this work.

In most cases this could be made to work async via a new determineUsername() function which uses .getUsername() internally. All authentication mangers now extend a base class which impliments username fetching and caching.

Some cases like getSharingUrl() or isItemOwner() which are public synchronous methods cannot be modified to be async so tey where modified to accept a username param as a second argument which uses getUsername() in the async functions that use them. These should still work as implemented if people continue to use them with ArcGISIdentityManager but might not work with API keys.

In our next breaking change we should:

  1. Remove the synchronous username entirely to force use of getUsername()
  2. Add new options for initiating API key and app auth in an async way to pre-cache the username.

Copy link
Member

@tomwayson tomwayson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good solution @patrickarlt!

@gavinr-maps gavinr-maps self-requested a review January 7, 2025 19:50
Copy link
Contributor

@gavinr-maps gavinr-maps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! A few small change ideas here:

packages/arcgis-rest-portal/src/sharing/helpers.ts Outdated Show resolved Hide resolved
packages/arcgis-rest-portal/src/sharing/helpers.ts Outdated Show resolved Hide resolved
demos/personal-api-keys/README.md Outdated Show resolved Hide resolved
demos/personal-api-keys/package.json Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for portal service operations with API keys/App authentication
4 participants