Skip to content
Connect an agent

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/authorize

TL;DR

QuestionAnswer
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.

FieldTypeRequiredDescription
codestringyesThe code GitHub sent the browser back with. at least 1 character; at most 200 characters.
codeVerifierstringnoThe 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

StatusMeaningBody
200The grant and the installations.GithubAuthorize
400The body is not valid, or GitHub refused the code (github.code_invalid).ErrorResponse
401Not signed in.ErrorResponse
403The request came from an origin that may not make changes.ErrorResponse
429Too many requests, or GitHub asked to wait (github.rate_limited).ErrorResponse
502GitHub could not be reached (github.unavailable).ErrorResponse
503The 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.

FieldTypeRequiredDescription
grantstringyesProof, for ten minutes and for this account only, of the installations the GitHub user can reach. Holds no secret.
installUrlstringyesWhere to install the App, for a GitHub user who can reach no installation of it yet.
expiresAtintegeryes
githubUserobjectyes
githubUser.loginstringyes
githubUser.idstringyes
installationsobject[]yes
installations[].idstringyes
installations[].accountobjectyes
installations[].account.loginstringyes
installations[].account.idstringyes
installations[].account.type"User" | "Organization"yes
installations[].repositorySelection"all" | "selected"yes
installations[].suspendedbooleanyes
installations[].linkedToobject | nullyesThe organisation it is linked to, when the caller is a member of it.
installations[].linkedTo.slugstringyes
installations[].linkedTo.namestringyes
installations[].linkedElsewherebooleanyesTrue when another organisation has it; that organisation is not named.

See also

DocWhy
API referenceEvery endpoint, and the error envelope
SchemasEvery request and response type
Tool referenceThe operations as callable tools