Comments (7)
accesstoken 会过期?
from blog.
@git-issue 有段时间隔一天请求就报401了,要不就是我使用姿势不对?:flushed:
from blog.
@git-issue 我找到原因了,是我把token作为内容一起提交了,github检测到这个行为之后自动把相关token移除了,果然是我使用的方式不对
from blog.
@MangiDu
@git-issue 我找到原因了,是我把token作为内容一起提交了,github检测到这个行为之后自动把相关token移除了,果然是我使用的方式不对
我是说,accesstoken 相当于密码,我一会用从来没过期呢。。。
from blog.
@git-issue 应该是不存在过期的情况的,我的情况是因为错误的使用导致github 自动移除 了相关token,所以继续使用这个token请求会报401,被我误以为是过期了
from blog.
对于我,,我的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.
好吧,原来token必须作为环境变量来储存。。。。。英语不好真的亏
from blog.
Related Issues (17)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blog.