【问题标题】:Deprecating API authentication through query parameters in Github通过 Github 中的查询参数弃用 API 身份验证
【发布时间】:2020-10-27 07:06:26
【问题描述】:

我最近收到一封电子邮件,说 github 正在弃用通过查询参数进行 API 身份验证

https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param/

我使用的网址类似于, https://github.com/login/oauth/authorize?scope=user:email%20read:user&client_id=

是否也不推荐使用客户端 ID 作为查询参数?如果有,还有其他方法吗?

【问题讨论】:

    标签: c# authentication github oauth


    【解决方案1】:

    是的

    从 2021 年 9 月 8 日开始,使用 access_token 作为查询参数来访问 API(作为用户或作为 GitHub 应用程序)或使用 client_id/client_secret 进行 OAuth 应用程序未经身份验证的调用将被禁用。

    如果您想使用客户端 ID,请将其放在 标题 中。例如:

    使用 client_id/client_secret 作为查询参数,

    如果您使用 OAuth 应用的 client_idclient_secret 以类似于

    的更高速率限制进行未经身份验证的调用
    curl "https://api.github.com/user/repos?client_id=my_client_id&client_secret=my_secret_id"
    

    相反,您应该使用以下格式:

    curl -u my_client_id:my_client_secret https://api.github.com/user/repos
    

    应使用HTTP basic authentication 对 API 进行身份验证。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-09
      • 2021-05-22
      • 2015-10-17
      • 2021-03-01
      • 2015-03-14
      • 1970-01-01
      • 1970-01-01
      • 2014-01-05
      相关资源
      最近更新 更多