api - Github 使用 2 因素身份验证创建 token

标签 api curl github oauth oauth-2.0

我正在尝试获得用户授权并取回 token 。用户启用了 2 因素身份验证。

这是我尝试使用的代码。它不会接受我通过短信获得的代码。如果用户没有启用 2fa,这会起作用。

curl -i -u $user -H "X-GitHub-OTP: $code" \
     -d '{"scopes": [ "repo" ], "note": "program"}' \
     https://api.github.com/authorizations

http://developer.github.com/v3/auth/#working-with-two-factor-authentication http://developer.github.com/v3/oauth/#create-a-new-authorization

最佳答案

这确实有效。我遇到了 SMS 代码过期的问题。

关于api - Github 使用 2 因素身份验证创建 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20065691/

相关文章:

wordpress - 如何修复 Hugo CMS 中 `found no layout file for "` 的错误 "page"HTML”?

git - 当我的分支和主人没有相关历史时如何做 pull 请求?

php - 使用 php-github-api 的 Github 身份验证

javascript - YouTube 隐藏式字幕与 API Player

php - 通过浏览器拒绝 CURL 权限,适用于 ssh

php - cURL connect() 超时

Django 返回 HTTP 301?

ruby-on-rails - 解析谷歌地理编码

javascript - 尝试以 HTML 格式显示 API 数据

api - 用于翻转 boolean 值的 RESTful API PUT/PATCH