Skip to main content

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/authorize and /oauth2/v2.0/token)

Azure AD configuration

In the Azure portal, for your app registration:

  1. Authentication → Redirect URI: http://localhost:27097/redirect (or the port/redirect_path you use).
  2. 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

mongo_oidc_human_callback-0.1.3.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

mongo_oidc_human_callback-0.1.3-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file mongo_oidc_human_callback-0.1.3.tar.gz.

File metadata

  • Download URL: mongo_oidc_human_callback-0.1.3.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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

Hashes for mongo_oidc_human_callback-0.1.3.tar.gz
Algorithm Hash digest
SHA256 49f6fcd03c43367716630e8e079ea9c218f6c71933c86eba7d7d8d3377727d54
MD5 6391f9282e1fb7d4d640a3772d433867
BLAKE2b-256 341dd7f1a02a7a14c17bfcb0da37fa2b8146f72e4282eacc86d284b22efdd5e7

See more details on using hashes here.

File details

Details for the file mongo_oidc_human_callback-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: mongo_oidc_human_callback-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","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

Hashes for mongo_oidc_human_callback-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a7a96a1762209a3c8b98eec8c20e865a6e74282d05b5e1d82f440dbc3058d599
MD5 532323c7d0809779fe8b02d8930ee96e
BLAKE2b-256 3ac7b81895659df5ac8a6bd2f9b30e562cefb64de5b444c7e7de42ea06176d6f

See more details on using hashes here.

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