我可以通过我的用户名和密码登录github帐户并使用api生成个人访问令牌吗?
答案 0 :(得分:1)
我找到了解决方案。参考GitHub文档https://developer.github.com/v3/guides/getting-started/#authentication,我通过了它,并能够创建可以满足我的目的的python脚本。
这里应该起作用(邮递员示例):
POST https://mycloud.example.com/api/v3/authorizations
{
"note" : "example-1",
"scopes" : [
"repo"
]
}
答案 1 :(得分:1)
根据此blog post,他们已弃用OAuth Authorizations API,后者支持生成个人访问令牌。
所以现在,您必须使用web settings页来生成它。
对OAuth授权API的调用
如果您要进行OAuth授权API调用以管理OAuth应用的授权或创建个人访问权限或OAuth令牌,例如:
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"}'
然后,您必须切换到Web应用程序流以生成访问令牌。