Skip to content

Fix CLI-created API keys returning 401 permission denied#456

Merged
aaronbrethorst merged 1 commit into
mainfrom
fix/cli-api-key-credentials
Feb 8, 2026
Merged

Fix CLI-created API keys returning 401 permission denied#456
aaronbrethorst merged 1 commit into
mainfrom
fix/cli-api-key-credentials

Conversation

@aaronbrethorst

Copy link
Copy Markdown
Member

Summary

  • Fix doCreate() in ApiKeyCliMain passing incorrect arguments to getOrCreateUserForIndexKey(): empty string for credentials and true for isAnonymous, causing keys to be created with ROLE_ANONYMOUS instead of ROLE_USER
  • Pass the actual key value and false to match the working pattern in CreateApiKeyAction
  • Update test mock expectations to verify the corrected arguments

Fixes #455

Test plan

  • All 48 tests in onebusaway-api-key-cli pass
  • Create an API key via CLI and verify it returns 200 instead of 401 against the API

doCreate() was passing incorrect arguments to getOrCreateUserForIndexKey():
empty string for credentials and true for isAnonymous, causing keys to be
created with ROLE_ANONYMOUS instead of ROLE_USER. Pass the actual key value
and false to match the working pattern in CreateApiKeyAction.

Fixes #455
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@aaronbrethorst aaronbrethorst merged commit ad62c20 into main Feb 8, 2026
1 of 2 checks passed
@aaronbrethorst aaronbrethorst deleted the fix/cli-api-key-credentials branch February 8, 2026 04:30
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.

onebusaway-api-key-cli: created API keys are non-functional due to empty credentials

2 participants