GET /v1/github/callback
Where GitHub sends the browser after an install (the App's setup and callback URL). A signed-out browser is sent to sign in and then back here with installation_id. Without a code, or with a code but no state this edge issued for the current session, it asks GitHub to authorize the App once more with a state bound to the session. With both, it exchanges the code for the App's user access token and checks that GET /user/installations lists installation_id and that the GitHub account administers the installation's account: it is that user account, or an active owner of that organization (GET /user/memberships/orgs/{org}). Seeing the installation is not enough, since GitHub lists it to anyone who can read one of its repositories. Then it connects the installation to the organization, taking it over from another organization if one held it, and drops the token (it is never stored). It redirects to redirect_to with github=connected, or with github_error=<reason>.

Query Parameters

code string optional query
Max length 512
state string optional query
Max length 512
installation_id string optional query
Pattern ^[1-9][0-9]{0,15}$
setup_action string optional query
Max length 32

Responses

302 Connected (or failed); redirect to the dashboard, or to GitHub to authorize first.

No response body

400 The request failed validation (invalid_request, invalid_url).
429 A rate, concurrency or quota limit applies (rate_limited, concurrency_limited, quota_exceeded).
500 Something failed inside B3OS (internal). Retry with backoff.
503 The node or the product is not available right now (node_unavailable, product_unavailable, capacity_unavailable).
curl -X GET 'https://beta.b3os.org/v1/github/callback' \  -H 'Authorization: Bearer YOUR_API_TOKEN'
const response = await fetch('https://beta.b3os.org/v1/github/callback', {  method: 'GET',  headers: {      "Authorization": "Bearer YOUR_API_TOKEN"  }});const data = await response.json();console.log(data);
import requestsheaders = {    'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.get('https://beta.b3os.org/v1/github/callback', headers=headers)print(response.json())
400 Response
{  "type": "https://docs.beta.b3os.org/errors#invalid_request",  "title": "Invalid request",  "status": 400,  "code": "invalid_request",  "detail": "1 field failed validation",  "instance": "req_01m5t4yg394wegr3j4y01qb363",  "errors": [    {      "pointer": "/url",      "detail": "must be an absolute http or https URL"    }  ]}
Ask a question... ⌘I