https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/
- Users are redirected to request their GitHub identity
- Users are redirected back to your site by GitHub
- Your app accesses the API with the user's access token
GET https://github.com/login/oauth/authorize
https://github.com/login/oauth/authorize?
client_id=9e9d8d40160aeaae7fdc&
scope=user,repo
POST https://github.com/login/oauth/access_token
{
"client_id": "9e9d8d40160aeaae7fdc",
"client_secret": "0b034c27d02128c7fe3d7c2dae15c2681180aabf",
"code": "ae87daa193bdb1d050cf"
}
返回access token
access_token=eb807fc0a493b9f5abea8a5fc1f32aff2a712dd9&scope=repo%2Cuser&token_type=bearer
GET https://api.github.com/user
request headers
Authorization: token eb807fc0a493b9f5abea8a5fc1f32aff2a712dd9