2012-06-16 06:16

github API v3 - 通过CURL获取访问令牌


I've been puzzling through the github API docs (v3) and I'm kind of stumped. For the initial step - the acquisition of the access token - it appears that the only way to do it within a web app is to rely on a callback URL, which gets posted a temporary code. That's then used in subsequent queries to their API.

Does anyone know if this can all be done in a single step, e.g. cURL - i.e. within a single block of code in one page? Passing off control flow to a different URL causes innumerable problems for my particular scenario.

Thanks! :)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • dongyizhui0616 dongyizhui0616 9年前

    This is the nature of OAuth. You could you try to use the basic authentication method, but if that doesn't fit your needs, then PHP has an OAuth library that should make authentication pretty painless. There are also a few PHP wrappers out there for the Github API, e.g. php-github-api.

    点赞 5 评论 复制链接分享