D
D
dron1122021-02-28 20:26:59
API
dron112, 2021-02-28 20:26:59

Why does GitHub Token become obsolete after push?

async fetchRepos({commit, state, dispatch}, payload) {
        commit('startFetchRepos', this.state.users.perPage)
        const headers = {
            "Authorization": `Token ${tokenGitHub}  `
        }

        try {
            let response = await axios.get(payload.reposUrl, {
                "method": "GET",
                "headers": headers
            })

            let userRepos = {
                id: payload.id,
                repos: response.data
            }

            commit('successFetchRepos', userRepos)
        } catch (e) {
            commit('failureFetchRepos', e.message)
        }
    },


I work with api github in order to use it without restrictions I use access token, but if I push to the repo, the token becomes obsolete and I have to generate a new one
How to get around this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daria Motorina, 2021-02-28
@dron112

Link from github support
Keeping GitHub OAuth tokens safe


While making your source code available in a public GitHub repository is awesome, it's important to be sure you don't accidentally commit your passwords, secrets, or anything else that other people shouldn't know.
Starting today you can commit more confidently, knowing that we will email you if you push one of your OAuth Access Tokens to any public repository with a git push command. As an extra bonus, we'll also revoke your token so it can't be used to perform any unauthorized actions on your behalf.

You need to store the token in the environment settings, which are ignored by git

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question