OIDC Human Callback for MongoDB: browser-based OAuth 2.0 Authorization Code Flow with PKCE (Azure AD and other OIDC providers).
Project description
mongo-oidc-human-callback
OIDC Human Callback for MongoDB Atlas authentication: OAuth 2.0 Authorization Code flow with PKCE (Azure AD and other OIDC providers).
Single dependency: pymongo (stdlib for the rest: urllib, logging, http.server, etc.).
Installation
pip install mongo-oidc-human-callback
Usage
from pymongo import MongoClient
from mongo_oidc_human_callback import OIDCHumanCallback
# Connect with human callback (browser opens + PKCE)
client = MongoClient(
"mongodb+srv://<cluster>.mongodb.net/",
authMechanism="MONGODB-OIDC",
authMechanismProperties={"OIDC_CALLBACK": OIDCHumanCallback()},
)
# First access: browser opens to sign in (e.g. Azure AD)
client.admin.command("ping")
Callback options
OIDCHumanCallback(
redirect_path="redirect", # or "callback" depending on Azure AD config
port=27097, # local callback server port
)
Features
- PKCE (Proof Key for Code Exchange)
- Token caching to avoid re-authenticating on each connection
- Local HTTP server to receive the OAuth redirect
- Automatic browser opening
- Azure AD compatibility (endpoints
/oauth2/v2.0/authorizeand/oauth2/v2.0/token)
Azure AD configuration
In the Azure portal, for your app registration:
- Authentication → Redirect URI:
http://localhost:27097/redirect(or theport/redirect_pathyou use). - API permissions → Microsoft Graph (or target API): e.g.
openid,profile,email.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mongo_oidc_human_callback-0.1.2.tar.gz.
File metadata
- Download URL: mongo_oidc_human_callback-0.1.2.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32bb91744feade1446f8cb1043eb5054b689c88ebe218c76782c88304db23691
|
|
| MD5 |
97f03ae1bd512e261ee013ff21ef1154
|
|
| BLAKE2b-256 |
be9c7f1c7a9b69bb63dcfa0bd25d0df2b66aa3095a071e123f7f481fe315c066
|
File details
Details for the file mongo_oidc_human_callback-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mongo_oidc_human_callback-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
592fa509f137c86632196d72bd783cec41d6d9f394af1f879fc24a395562b4d3
|
|
| MD5 |
b971b25e9f6b1563ecc5f8ab27b6af56
|
|
| BLAKE2b-256 |
16fabce0d4f6d5bb1fda0340c3db96f0bc8aa41b6a83b9c6e51a9451f60cc2d1
|