1

I'm trying to generate a GitHub App scoped access token via the REST API, but continue to run into a "Not Found" response which I understand to mean that the authentication is failing. Per the documentation, I "must use Basic Authentication when accessing this endpoint, using the client_id and client_secret of the GitHub App as the username and password". In addition, the request payload requires an authentication token which I understand can be a "personal access token, an OAuth token, an installation access token or a JSON Web Token" (see: https://github.com/octokit/core.js#authentication).

So far I have:

  1. Created the app, noting its CLIENT_ID and CLIENT_SECRET.
  2. Installed the app giving it access to all repositories.
  3. Created a personal access token (classic) with permissions for all scopes.

Next, I sent a cURL request using the same format as in the documentation:

curl -L \
  -X POST \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <PERSONAL_ACCESS_TOKEN>"\
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/applications/CLIENT_ID/token/scoped \
  -d '{"access_token":"CLIENT_SECRET","target":"<MY_GITHUB_USERNAME>","permissions":{"metadata":"read","issues":"write","contents":"read"}}'

Submitting the request results in the following response:

{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest"
}

Do I misunderstand the documentation and the use of the personal access token (PAT), or do I perhaps have an issue with the permissions configuration in the PAT or the app itself?

Many thanks in advance!

Chris
  • 27
  • 1
  • 6

0 Answers0