Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub API: Personal access token removes itself

I need an access to Github GraphQL API in order to permanently make the following request each N hours:

query($ids: [ID!]!) {
rateLimit {
    cost
    remaining
    resetAt
}

nodes(ids: $ids) {
    ... on Repository {
        milestones(last: 100) {
            nodes {
                issues(last: 100) {
                    nodes {
                        closedAt
                        closed
                    }
                }

                state
                dueOn
            }
        }
    }
}
}
  1. I create a personal access token like it is said here with only 1 scope: public_repo.
  2. I copy and paste it to my application properties.
  3. I launch my application, it is working as expected.
  4. But sometimes, under some unclear circumstances, almost randomly (during app execution or after shut down), Github API responses with 401 Unauthorized.
  5. I visit my Settings / Developer settings / Personal access tokens. Last created token disappears.
  6. Why? What am I doing wrong?
like image 379
voismager Avatar asked Aug 27 '26 18:08

voismager


1 Answers

Probably you commit the token to your GitHub repo. if its the case Github will remove the token immediately. so you need to set your token as a variable environment in your system.

like image 106
EL AZIZI Youssouf Avatar answered Aug 31 '26 13:08

EL AZIZI Youssouf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!