Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Github APIs for authentication

Prachi Damle edited this page Aug 8, 2017 · 4 revisions

Github APIs

These are the APIs rancher calls for authentication and user/org/team lookup against a Github server.

API endpoint

API List

  • All Github APIs are HTTP POST or GET APIs.

  • For Github POST set following headers:

    • "Content-Type", "application/x-www-form-urlencoded"
    • "Accept", "application/json"
  • For Github GET set following headers:

    • "Authorization", "token "+ githubAccessToken
    • "Accept", "application/json"
    • "user-agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36)"
  • Authenticate (clientId, clientSecret): HTTP POST to [Github Server Hostname + "/login/oauth/access_token"] The accessToken received should be used in the "Authorization" header for subsequent API calls.

  • Get User by name: HTTP GET to [Github API endpoint + "/users/<user_name>"]

  • Get Org by name: HTTP GET to [Github API endpoint + "/orgs/<org_name>"]

  • Get Team by Id: HTTP GET to [Github API endpoint + "/teams/<team_id>"]

  • Get User Details HTTP GET to [Github API endpoint + "/user"] with Github Access token in Authorization header, to get current user details. OR HTTP GET to [Github API endpoint + "/user/<user_id>"] to get details of some other user.

  • Get Orgs of a user HTTP GET to [Github API endpoint + "/user/orgs?per_page=1"] with Github Access token in Authorization header

  • Get Teams of a user HTTP GET to [Github API endpoint + "/user/teams?per_page=100"] with Github Access token in Authorization header

For detail implementation, refer: https://github.com/rancher/rancher-auth-service/tree/master/providers/github

Clone this wiki locally