Skip to content

Instantly share code, notes, and snippets.

@kkas
Last active August 29, 2015 14:16
Show Gist options
  • Save kkas/b48e8854af0a5a3715a9 to your computer and use it in GitHub Desktop.
Save kkas/b48e8854af0a5a3715a9 to your computer and use it in GitHub Desktop.
GitHub API でクレデンシャルを受け取るときのサンプル
kikui@kikui01:~$ curl -u kentakikui@gmail.com -d '{"scopes": ["repo", "delete_repo"], "note": "CF Service Broker"}' https://api.github.com/authorizations
Enter host password for user 'kentakikui@gmail.com': <アカウントのパスワードを入力>
{
"id": 15873484,
"url": "https://api.github.com/authorizations/15873484",
"app": {
"name": "CF Service Broker (API)",
"url": "https://developer.github.com/v3/oauth_authorizations/",
"client_id": "00000000000000000000"
},
"token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", ## ここにアクセスtokenが入る
"note": "CF Service Broker",
"note_url": null,
"created_at": "2015-03-09T05:42:47Z",
"updated_at": "2015-03-09T05:42:47Z",
"scopes": [
"repo",
"delete_repo"
]
}
kikui@kikui01:~$

##参考

###認証APIについて

URL: https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization

以下パラメタの抜粋

request parameters:

Name Type Description
scopes array A list of scopes that this authorization is in.
note string Required A note to remind you what the OAuth token is for.

###スコープについて

URL: https://developer.github.com/v3/oauth/#scopes

Name Description
repo Grants read/write access to code, commit statuses, and deployment statuses for public and private repositories and organizations.
delete_repo Grants access to delete adminable repositories.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment