Class GitHubFederatedAuthProvider
H8 (DoD §4 gap (a) "GitHub-style"): GitHub OAuth2 federated auth provider.
Unlike , GitHub is OAuth2 only — no
id_token and no OIDC discovery, so we exchange the auth code for an
access_token and then call /user + /user/emails to build
the .
PKCE is supported (GitHub added S256 PKCE in 2022 and ignores code_verifier
silently for old apps), nonce is not — GitHub has no id_token to bind it to.
Required scope to obtain a primary verified email when the profile email is
private: user:email (we add it implicitly if the caller forgot).
public sealed class GitHubFederatedAuthProvider : IFederatedAuthProvider
Inheritance
Implements
Properties
ProviderId
Provider ID used as key in ExternalIdentities dict. E.g. "google", "azure-ad".
public string ProviderId { get; }
Methods
CreateChallengeAsync(string, string, CancellationToken)
Build authorization redirect URI with state, nonce, PKCE.
public Task<FederationChallenge> CreateChallengeAsync(string callbackUrl, string returnUrl, CancellationToken ct = default)
HandleCallbackAsync(string, string, string?, string?, CancellationToken)
Handle callback: exchange code → validate tokens → return identity.
public Task<ExternalAuthResult> HandleCallbackAsync(string code, string callbackUrl, string? codeVerifier = null, string? nonce = null, CancellationToken ct = default)