Skip to main content

FastAPI middleware to authenticate Github OIDC Tokens

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi_github_oidc-0.3.0.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastapi_github_oidc-0.3.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_github_oidc-0.3.0.tar.gz.

File metadata

  • Download URL: fastapi_github_oidc-0.3.0.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fastapi_github_oidc-0.3.0.tar.gz
Algorithm Hash digest
SHA256 2a363a735265cbdcbf15479ad97637155b725cd10eb20c1bb44c21d0a5da735c
MD5 5e32dd86e6cabf09359376a9a664c646
BLAKE2b-256 60b5d743c8592d3c3760813405d200b9e18868dfee2765b3e402a004194d4f73

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastapi_github_oidc-0.3.0.tar.gz:

Publisher: release.yml on atopile/fastapi-github-oidc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fastapi_github_oidc-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_github_oidc-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15d0543be9edaca5d194183702033992a53c684b5cdd810cf0d4dcbc4a69e884
MD5 e11f35473f59dd400f642cf8ec60511c
BLAKE2b-256 1b01023c69e4cec8ba47df6d123b0d2c671acaf0c36cacb77aa221e08ac8c59a

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastapi_github_oidc-0.3.0-py3-none-any.whl:

Publisher: release.yml on atopile/fastapi-github-oidc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page