
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
fastapi-third-party-auth
Advanced tools
Simple library for using a third party authentication service like Keycloak or Auth0 with FastAPI
Documentation: https://fastapi-third-party-auth.readthedocs.io/
Source Code: https://github.com/aiwizo/fastapi-third-party-auth
Simple library for using a third party authentication service with FastAPI. Verifies and decrypts 3rd party OpenID Connect tokens to protect your endpoints.
Easily used with authentication services such as:
FastAPI's generated interactive documentation supports the grant flows:
GrantType.AUTHORIZATION_CODE
GrantType.IMPLICIT
GrantType.PASSWORD
GrantType.CLIENT_CREDENTIALS
poetry add fastapi-third-party-auth
Or, for the old-timers:
pip install fastapi-third-party-auth
See this example for how to use
docker-compose
to set up authentication with fastapi-third-party-auth
+
Keycloak.
from fastapi import Depends
from fastapi import FastAPI
from fastapi import Security
from fastapi import status
from fastapi_third_party_auth import Auth
from fastapi_third_party_auth import GrantType
from fastapi_third_party_auth import KeycloakIDToken
auth = Auth(
openid_connect_url="http://localhost:8080/auth/realms/my-realm/.well-known/openid-configuration",
issuer="http://localhost:8080/auth/realms/my-realm", # optional, verification only
client_id="my-client", # optional, verification only
scopes=["email"], # optional, verification only
grant_types=[GrantType.IMPLICIT], # optional, docs only
idtoken_model=KeycloakIDToken, # optional, verification only
)
app = FastAPI(
title="Example",
version="dev",
dependencies=[Depends(auth)],
)
@app.get("/protected")
def protected(id_token: KeycloakIDToken = Security(auth.required)):
return dict(message=f"You are {id_token.email}")
The IDToken class will accept any number of extra fields but you can also validate fields in the token like this:
class MyAuthenticatedUser(IDToken):
custom_field: str
custom_default: float = 3.14
auth = Auth(
...,
idtoken_model=MyAuthenticatedUser,
)
FAQs
Simple library for using a third party authentication service like Keycloak or Auth0 with FastAPI
We found that fastapi-third-party-auth demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.