Organisations
Prove which GitHub App installations you can reach
Trades the code GitHub sent the browser back with for a user token, reads the installations of the App that GitHub user can reach, revokes the token, and answers a grant that proves it for ten minutes, to this account only.
POST
/github/authorizeTL;DR
| Question | Answer |
|---|---|
| What does it do? | Prove which GitHub App installations you can reach. |
| What does it take? | A JSON body of type GithubAuthorizeBody. |
| What does it return? | Status 200 with a body of type GithubAuthorize. |
| What can go wrong? | 400 the body is not valid, or GitHub refused the code (github.code_invalid); 401 not signed in; 403 the request came from an origin that may not make changes; 429 too many requests, or GitHub asked to wait (github.rate_limited); 502 GitHub could not be reached (github.unavailable); 503 the GitHub App is not set up on this server (github.not_configured), or organisations are not. Every failure uses the one error envelope. |
What it does
Trades the code GitHub sent the browser back with for a user token, reads the installations of the App that GitHub user can reach, revokes the token, and answers a grant that proves it for ten minutes, to this account only. No token is stored.
Request body
The body has the type GithubAuthorizeBody.
| Field | Type | Required | Description |
|---|---|---|---|
code | string | yes | The code GitHub sent the browser back with. at least 1 character; at most 200 characters. |
codeVerifier | string | no | The PKCE verifier, when the portal started the sign-in with a challenge. at least 43 characters; at most 128 characters; pattern ^[A-Za-z0-9._~-]+$. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | The grant and the installations. | GithubAuthorize |
| 400 | The body is not valid, or GitHub refused the code (github.code_invalid). | ErrorResponse |
| 401 | Not signed in. | ErrorResponse |
| 403 | The request came from an origin that may not make changes. | ErrorResponse |
| 429 | Too many requests, or GitHub asked to wait (github.rate_limited). | ErrorResponse |
| 502 | GitHub could not be reached (github.unavailable). | ErrorResponse |
| 503 | The GitHub App is not set up on this server (github.not_configured), or organisations are not. | ErrorResponse |
Response body
A 200 answer has the type GithubAuthorize.
| Field | Type | Required | Description |
|---|---|---|---|
grant | string | yes | Proof, for ten minutes and for this account only, of the installations the GitHub user can reach. Holds no secret. |
installUrl | string | yes | Where to install the App, for a GitHub user who can reach no installation of it yet. |
expiresAt | integer | yes | |
githubUser | object | yes | |
githubUser.login | string | yes | |
githubUser.id | string | yes | |
installations | object[] | yes | |
installations[].id | string | yes | |
installations[].account | object | yes | |
installations[].account.login | string | yes | |
installations[].account.id | string | yes | |
installations[].account.type | "User" | "Organization" | yes | |
installations[].repositorySelection | "all" | "selected" | yes | |
installations[].suspended | boolean | yes | |
installations[].linkedTo | object | null | yes | The organisation it is linked to, when the caller is a member of it. |
installations[].linkedTo.slug | string | yes | |
installations[].linkedTo.name | string | yes | |
installations[].linkedElsewhere | boolean | yes | True when another organisation has it; that organisation is not named. |
See also
| Doc | Why |
|---|---|
| API reference | Every endpoint, and the error envelope |
| Schemas | Every request and response type |
| Tool reference | The operations as callable tools |