Skip to content

auth keys commands: --app flag doesn't resolve app names #172

@umair-ably

Description

@umair-ably

Problem

The --app flag description says "The app ID or name (defaults to current app)", but in all auth keys commands (get, list, create, current, switch, revoke, update), flags.app is used directly as an app ID without resolving names:

let appId = flags.app || this.configManager.getCurrentAppId();

This means --app "My App" will fail because the name is passed directly to the Control API URL (/apps/${appId}/...) which expects an actual app ID.

Expected behavior

--app should resolve names to IDs using resolveAppIdFromNameOrId() (or use resolveAppId(flags) / requireAppId(flags) which already handle this).

Affected commands

  • auth keys get
  • auth keys list
  • auth keys create
  • auth keys current
  • auth keys switch
  • auth keys revoke
  • auth keys update

Suggested fix

Replace the direct flags.app || pattern with await this.resolveAppId(flags) or await this.requireAppId(flags), which already check flags.app first and resolve names before falling back to getCurrentAppId().

Note: auth keys get has special logic to extract app ID from APP_ID.KEY_ID format args — that path would need to be preserved.

Found via PR #171 review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions