Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Unable to access v2 APIs with project-specific API tokens #77

@ueokande

Description

@ueokande

CircleCI v1 API supports both project-specific API tokens and user's API tokens to get and start jobs on our private repositories. Although we can use personal API tokens to manage our private repository on v2 API, project-specific API tokens do not work.

For v1 APIs, we can get job information on our private projects by the following curl:

$ curl -sSfL -u"${CIECLE_TOKEN}:" "https://circleci.com/api/v1.1/project/$PROJECT_SLUG/${BUILD_NUM}"
{
  "compare": null,
   ...
}

where CIRCLE_TOKEN is allowed with both project-specific API tokens and personal API tokens.

For v2 APIs, we can use personal API tokens to access our private repository:

$ curl -u"${PERSONAL_TOKEN}:" https://circleci.com/api/v2/project/$PROJECT_SLUG/job/$BUILD_NUM
{
  "web_url" : "https://circleci.com/gh/our-org/repo-name/123456",
  ...
}

but using project-specific tokens returns 404:

$ curl -u"${PROJECT_SPECIFIC_TOKEN}:" https://circleci.com/api/v2/project/$PROJECT_SLUG/job/$BUILD_NUM
{
  "message" : "Job not found"
}

The v2 API should also supports project-specific API tokens.

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