Enhancement: Support API key for authentication #1

Open
opened 2025-03-26 12:18:45 -04:00 by nick · 0 comments
Owner

Description

Enhance the 753 Data Sync script to support authentication via API key as an alternative to the current username/password method when generating a token for ArcGIS Online access. This provides a more secure and automation-friendly approach, particularly for service accounts and CI/CD environments.


Proposed Behavior

  • If an API_KEY environment variable is present in the .env file, the script should use this key to authenticate with ArcGIS Online.
  • If the API_KEY is not present, the script should fallback to using the existing USERNAME and PASSWORD credentials.

This ensures full backward compatibility while enabling a more secure authentication method.


New Environment Variable

Variable Name Description
API_KEY Optional. If provided, the script will use this key to authenticate with ArcGIS Online instead of username/password.

Benefits

  • Improves security by allowing secrets management systems to inject API keys.
  • Simplifies authentication in automated or headless environments.
  • Avoids the need to manage usernames and passwords for service accounts.
  • Maintains compatibility with existing configurations.

Acceptance Criteria

  • Add support for an optional API_KEY field in the .env file.
  • Update the authentication logic to prioritize API key usage.
  • Retain current username/password fallback behavior for legacy compatibility.
  • Update project documentation and .env.example with the new variable and usage notes.

Implementation Notes

  • API key-based authentication in ArcGIS typically involves appending the key to requests or using it to generate tokens via a dedicated endpoint.
  • Ensure the script cleanly handles cases where both methods fail, and logs a clear error message.
#### **Description** Enhance the **753 Data Sync** script to support authentication via **API key** as an alternative to the current **username/password** method when generating a token for ArcGIS Online access. This provides a more secure and automation-friendly approach, particularly for service accounts and CI/CD environments. --- #### **Proposed Behavior** - If an `API_KEY` environment variable is present in the `.env` file, the script should use this key to authenticate with ArcGIS Online. - If the `API_KEY` is **not present**, the script should **fallback** to using the existing `USERNAME` and `PASSWORD` credentials. This ensures full backward compatibility while enabling a more secure authentication method. --- #### **New Environment Variable** | Variable Name | Description | |---------------|-------------| | `API_KEY` | Optional. If provided, the script will use this key to authenticate with ArcGIS Online instead of username/password. | --- #### **Benefits** - Improves security by allowing secrets management systems to inject API keys. - Simplifies authentication in automated or headless environments. - Avoids the need to manage usernames and passwords for service accounts. - Maintains compatibility with existing configurations. --- #### **Acceptance Criteria** - [ ] Add support for an optional `API_KEY` field in the `.env` file. - [ ] Update the authentication logic to prioritize API key usage. - [ ] Retain current username/password fallback behavior for legacy compatibility. - [ ] Update project documentation and `.env.example` with the new variable and usage notes. --- #### **Implementation Notes** - API key-based authentication in ArcGIS typically involves appending the key to requests or using it to generate tokens via a dedicated endpoint. - Ensure the script cleanly handles cases where both methods fail, and logs a clear error message.
nick added the
enhancement
label 2025-03-26 12:36:04 -04:00
nick self-assigned this 2025-03-26 12:36:12 -04:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: nick/753-Data-Sync#1
No description provided.