LoginSignup
77
71

More than 5 years have passed since last update.

githubのAPIトークンを取得する

Last updated at Posted at 2013-04-07

APIキーを取得する

githubのSettingからAPIトークンを取得する方法がわからなかったのでhelpを参照した所、次の方法が見つかった。

$ curl -u 'username' -d '{"scopes":["repo"],"note":"Help example"}' https://api.github.com/authorizations

usernameの部分を自分のアカウント名に変更して上のコマンドを実行する。
パスワードを聞かれるのでgithubアカウントのパスワードを入力する。
すると以下の様な文字列が帰ってくる。
"token":"your_token"のところにAPIトークンが入っているのでこれを使えばいい。

{
  "scopes": [
    "repo"
  ],
  "token": "your_token",
  "app": {
    "url": "http://developer.github.com/v3/oauth/#oauth-authorizations-api",
    "name": "Help example (API)"
  },
  "url": "https://api.github.com/authorizations/123456",
  "note": "Help example",
  "note_url": null,
  "id": 123456,
}

77
71
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
77
71