【发布时间】:2020-05-19 05:21:40
【问题描述】:
更新:即使是这样的请求也会获得错误的凭据 ==>
curl -H "Authorization: token [token]" https://api.github.com
================
我在我的 iOS 应用程序中这样请求 GitHub OAuth:
URL: https://github.com/login/oauth/authorize,
params: client_id: ****, redirect_uri: app_url, scope: "repo", state: "0"
从 Safari 重定向后,我得到一个代码。我需要访问两件事:
- 用户数据,如电子邮件等。同时更新用户数据。
- 公共和私有存储库中的存储库和提交列表。
我提出以下要求:
网址:https://api.github.com/user,获取并打补丁 标头:授权:令牌 [代码]
URL: https://api.github.com/repos/:username/:repoName
Header: Authorization: token [code]
但不幸的是,我收到以下错误:
401, Unauthorized
{
"message": "Bad credentials",
"documentation_url": "https://developer.github.com/v3"
}
问题是什么,我该如何解决?
【问题讨论】:
标签: github oauth github-api github-oauth