Missing secret gists in GitHub's API

Question:

According to the documentation, I can either send the request with authorization (token) in order to get all of my gists, or anonymously and I will get public popular gists.

My Python code is:

url = "https://api.github.com/gists"
with Get(
    url,
    headers={"Accept": accept},
    params={"since": since, "per_page": per_page, "page": page},
    auth=("token", token)
) as response:
    return response

When token is set to None, I get all public gists (not mine) and when token is set to my OAuth token, I get all of my gists.

However, the issue is that it only gives me my non-secret gists instead of secret and public together.

Initially I was thinking that my token was wrong and therefore I was not getting the secret gists, but turns out that the token is correct (for sure, I can even post new gists) and also has permissions to read/write gists, and that is why it is weird.

The issue is also not related to either params or headers, tested.

Additional Information:
Get is a class which implements a context-manager and sends a get request [link].

Asked By: Jonathan1609

||

Answers:

After a long research I found out that GitHub’s OAuth token from Developer Settings is not enough to perform this action and I need to create a GitHub App in order to extend GitHub.

I used this tool:
https://github.com/defunkt/gist
in order to ask GitHub for such a particular token (which is being used in the GitHub App), and then I started using it, and it worked!

Answered By: Jonathan1609

With the new fine grained personal access tokens this can now be done without a GitHub App:

You need to give read-write access to Gists under Account Permissions: Account Permissions under Personal Access Token creation scren

Answered By: Oskar Austegard