FastAPI Github OIDC Actions Middleware That Just Works™
FastAPI compatible middleware to authenticate Github OIDC Tokens
Want people to use your thing? Great! So we do. Make is easy!
Github OIDC is a secure authentication mechanism with near-zero configuration required for many applications.
Server Side
uv add "fastapi-github-oidc[server]"
from fastapi import Security, FastAPI
from github_oidc.server import GithubOIDC, GithubOIDCClaims
app = FastAPI()
@app.get("/")
async def root(claims: GithubOIDCClaims = Security(GithubOIDC())):
return claims
Client Side
uv add "fastapi-github-oidc"
You must also have either httpx or requests installed
from github_oidc.client import get_actions_header
response = httpx.get(
"https://atopile.io",
headers=get_actions_header("atopile.io"),
)
response.raise_for_status()
Then, in your Action:
# ...
jobs:
my-job:
permissions:
id-token: write
contents: read
steps:
# ...
- run: uv run my-script.py
Metadata
Release files for fastapi-github-oidc 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastapi_github_oidc-0.3.0.tar.gz | 20.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastapi_github_oidc-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.8 kB
Release files / fastapi_github_oidc-0.3.0.tar.gz
| Download URL | fastapi_github_oidc-0.3.0.tar.gz |
|---|---|
| Size | 20.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a363a735265cbdcbf15479ad97637155b725cd10eb20c1bb44c21d0a5da735c
|
|
BLAKE2b-256 checksum How to use checksums |
60b5d743c8592d3c3760813405d200b9e18868dfee2765b3e402a004194d4f73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2025.
Transparency logRelease files / fastapi_github_oidc-0.3.0-py3-none-any.whl
| Download URL | fastapi_github_oidc-0.3.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
15d0543be9edaca5d194183702033992a53c684b5cdd810cf0d4dcbc4a69e884
|
|
BLAKE2b-256 checksum How to use checksums |
1b01023c69e4cec8ba47df6d123b0d2c671acaf0c36cacb77aa221e08ac8c59a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 10, 2025.
Transparency log