使用 api 在 github 中生成个人访问令牌

Generate personal access token in github using api

有什么方法可以通过我的用户名和密码登录到我的 github 帐户并使用 api 生成个人访问令牌?

我找到了解决方案。参考 GitHub 文档 https://developer.github.com/v3/guides/getting-started/#authentication 我通过了它并且能够制作一个可以满足我的目的的 python 脚本。

这是应该起作用的(邮递员示例):

POST https://mycloud.example.com/api/v3/authorizations
{
  "note" : "example-1",
  "scopes" : [
    "repo"
  ]
}

根据此 blog post, they've deprecated the OAuth Authorizations API,支持生成个人访问令牌。

所以现在,您必须使用 web settings 页面生成它。

Calls to OAuth Authorizations API

If you're making OAuth Authorization API calls to manage your OAuth app's authorizations or to create personal access or OAuth tokens like:

curl -u my_username:my_password -X POST "https://api.github.com/authorizations" -d '{"scopes":["public_repo"], "note":"my token", "client_id":"my_client_id", "client_secret":"my_client_secret"}'

Then you must switch to the web application flow to generate access tokens.