Can't create an installation access token

It’s been 2 days trying to create my installation access token with no success.
So as a first step :

curl -i -H "Authorization: Bearer <JWT>" -H "Accept: application/vnd.github.machine-man-preview+json" https://api.github.com/app

and I get a

HTTP/1.1 200 OK
Date: Fri, 12 Jun 2020 09:59:56 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 2492
Server: GitHub.com
Status: 200 OK
...
{
  "id": 68327,
  "slug": "***",
  "node_id": "MDM**=",
  "owner": {
    "login": "bilelelleuch",
    "id": 53218357,


which means My JWT is OK…
So once I ask for an installation access token via a post request like this :

curl -i -X POST -H "Authorization: Bearer <JWT>" -H "Accept: application/vnd.github.machine-man-preview+json" https://api.github.com/app/installations/68327/access_tokens

I receive a

HTTP/1.1 404 Not Found
Date: Fri, 12 Jun 2020 10:07:09 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 125
Server: GitHub.com
Status: 404 Not Found

and same for a get request with https://api.github.com/app/installations/68327

:wave: @bilelelleuch , welcome to the GitHub Support Community and for posting this question! :v:

The first request to https://api.github.com/app returns the authenticated GitHub App, where the value of id of 68327 represents the identifier for the GitHub App itself and not an installation.

If you’re interested in creating an installation token, you’ll first need to make a request that lists the installations for the authenticated app (you must use a JWT to access that endpoint). In the response, each element in the collection represents an installation with their own respective unique ids.

Once you’ve determined which id you’re interested in creating an installation token for, you can specify it in the request that previously returned the 404 Not Found (replace :installation_id):

curl -i -X POST -H "Authorization: Bearer <JWT>" -H "Accept: application/vnd.github.machine-man-preview+json" https://api.github.com/app/installations/:installation_id/access_tokens

Curious to hear how you get on!

1 Like

Worked perfectly fine.
Thanks a lot ! much appreciated !

1 Like