GitHub authentication provider. Supports the ``bearer`` auth scheme, used for PATs, fine-grained PATs, OAuth tokens, and GitHub App installation tokens.
| 6 | |
| 7 | |
| 8 | class GitHubAuth(AuthProvider): |
| 9 | """GitHub authentication provider. |
| 10 | |
| 11 | Supports the ``bearer`` auth scheme, used for PATs, fine-grained PATs, |
| 12 | OAuth tokens, and GitHub App installation tokens. |
| 13 | """ |
| 14 | |
| 15 | key = "github" |
| 16 | supported_auth_schemes = ("bearer",) |
| 17 | |
| 18 | def auth_headers(self, token: str, auth_scheme: str) -> dict[str, str]: |
| 19 | """Return ``Authorization: Bearer <token>``.""" |
| 20 | if auth_scheme != "bearer": |
| 21 | raise ValueError( |
| 22 | f"GitHubAuth does not support auth scheme {auth_scheme!r}" |
| 23 | ) |
| 24 | return {"Authorization": f"Bearer {token}"} |
no outgoing calls