github - Gist 中的个人访问 token

标签 github github-api gist

我创建了一个个人访问 token ( https://github.com/settings/tokens ) 给 Gist烫发。

我试图用它来创建一个要点,但我得到了

{
  "message": "Not Found",
  "documentation_url": "https://developer.github.com/v3"
}

我的要求是:
POST /gist HTTP/1.1
Host: api.github.com
Connection: close
X-Client-Data: CJO2yQEIorbJAQjBtskBCPqcygEIqZ3KAQjSncoBCKijygE=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Accept-Language: en-US,en;q=0.8,es;q=0.6
Authorization: Basic blablablablablabla
Content-Length: 142

{
  "description": "the description for this gist",
  "files": {
    "file1.txt": {
      "content": "String file contents"
    }
  }
}

不能使用个人 token 在要点中发布吗?

最佳答案

问题是不应该使用基本身份验证,而是使用特定的 header 来提供 token 。请求应该是:

POST /gist HTTP/1.1
Host: api.github.com
Connection: close
X-Client-Data: CJO2yQEIorbJAQjBtskBCPqcygEIqZ3KAQjSncoBCKijygE=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Accept-Language: en-US,en;q=0.8,es;q=0.6
Authorization: token aabbaabbaabbabababababababababababababab
Content-Length: 142  

{
  "description": "the description for this gist",
  "files": {
    "file1.txt": {
      "content": "String file contents"
    }
  }
}

关于github - Gist 中的个人访问 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47266034/

相关文章:

rest - Github GraphQL API : How can I gather specific user's repositories?

github - 删除以匿名方式创建的 secret 要点

git - 分支正在 git push 上 merge 到自己中

github-api - github api 以及如何获取拉取的代码片段和注释

git - 需要解释 "git push"命令是如何工作的

github-api - GitHub API : how efficiently get the total contributors amount per repository?

git - 将 gist 与 github 存储库链接,但将不同的文件推送到每个

ipython-notebook - 我更新了ipython笔记本的要点,但是nbviewer为什么不更新?

github 上的 git 存储库

git 从 pull 请求中删除提交