Connect GitHub
Sign in with GitHub through OAuth 2.0: the numeric account id is the identity and the primary verified address is the address. Built and tested locally against a stand-in; no GitHub OAuth app was used.
State in this release
Built and tested locally against a stand-in for GitHub that checks what the service sends: the Accept header, the PKCE verifier, the client secret, the bearer token and User-Agent on the two API calls, and the refusal of every malformed answer. No GitHub OAuth app was used, so GitHub's consent screen, rate limits and organisation approval policies are untested here. Run it once against your own OAuth app before relying on it.
GitHub's OAuth apps are OAuth 2.0, not OpenID Connect: there is no discovery document and no ID token, so this is not the generic OpenID Connect type. The mapping, linking, domain claim and sign-in journey of that guide apply.
What the preset does
The authorization request carries state and a PKCE S256 challenge and asks for read:user and user:email, the only scopes a connection may ask for. The callback exchanges the code, with the PKCE verifier and the client secret, for an access token; GitHub reports a refused code with a 200 and an error body, which the service treats as a refusal without repeating anything GitHub said.
GET /user names the account. The identity is its numeric id, never the login, which can be renamed and reused, and never an address. GET /user/emails lists the addresses and the one that is both primary and verified is the address, the only one the service reads. The profile's public email is never used. A login with no such address is refused by the default mapping.
Every request goes through the hardened outbound fetcher: HTTPS, public addresses only, bounded, and no redirects, since a redirect would re-send the bearer token. The access token is used for the two reads and dropped; it is never stored, logged or shown.
Create the connection
At GitHub create an OAuth app with the connection's callback URL as its authorization callback URL, and keep the client id and a client secret. Create the connection with the strategy github, a config holding client_id, and the secret as client_secret. Scopes default to read:user and user:email, and user:email must stay. Enable it with the status route and sign in through your application, or try it first with the console test login.
Request · json
POST /v1/console/accounts/{account_id}/directories/{directory_id}/connections
{
"strategy": "github",
"display_name": "Sign in with GitHub",
"config": { "client_id": "Iv1.0123456789abcdef" },
"client_secret": "the-secret-github-gave-you",
"jit_enabled": true
}Linking existing accounts
An existing account is linked only when the address is GitHub's primary verified one, the connection is trusted for email, the address domain has a verified claim on the connection, and the person has no other federated identity. Another GitHub account that claims an address an account already holds is not linked either, whatever it proves: an account has one identity per connection, so the link is refused. The address is a hint, never the key.
Not covered
Only the first 100 addresses of an account are read, and organisation or team membership is not read. If you need those, connect the identity provider your organisation fronts GitHub with.