Git Product home page Git Product logo

Comments (7)

git-issue avatar git-issue commented on August 24, 2024

accesstoken 会过期?

from blog.

MangiDu avatar MangiDu commented on August 24, 2024

@git-issue 有段时间隔一天请求就报401了,要不就是我使用姿势不对?:flushed:

from blog.

MangiDu avatar MangiDu commented on August 24, 2024

@git-issue 我找到原因了,是我把token作为内容一起提交了,github检测到这个行为之后自动把相关token移除了,果然是我使用的方式不对

from blog.

git-issue avatar git-issue commented on August 24, 2024

@MangiDu
@git-issue 我找到原因了,是我把token作为内容一起提交了,github检测到这个行为之后自动把相关token移除了,果然是我使用的方式不对

我是说,accesstoken 相当于密码,我一会用从来没过期呢。。。

from blog.

MangiDu avatar MangiDu commented on August 24, 2024

@git-issue 应该是不存在过期的情况的,我的情况是因为错误的使用导致github 自动移除 了相关token,所以继续使用这个token请求会报401,被我误以为是过期了

from blog.

plh97 avatar plh97 commented on August 24, 2024

对于我,,我的github accesstoken 放在了header里面,如果说将token 放在headers里面,会让github认为这是危险操作,移除我的token,如果不放在headers里面,我就无法通过graphql拿到我github仓库数据了。。

const config = require(path.resolve("./config/project.js"))
axios({
    url: `https://api.github.com/graphql`,
    method: 'post',
    headers: {
        'Authorization': `bearer ${config.access_token}`,
        'Content-Type': 'application/json'
    },
    data: {
        query: `{
            repositoryOwner(login:"pengliheng"){
                repository(name:"pengliheng.github.io"){
                    description
                    object(expression: "master:README.md") {
                        ... on Blob {
                            text
                        }
                    }
                }
            }
        }`
    }
})

from blog.

plh97 avatar plh97 commented on August 24, 2024

_20180221123018
好吧,原来token必须作为环境变量来储存。。。。。英语不好真的亏

from blog.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.