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.1.tar.gz (5.9 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.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mongo_oidc_human_callback-0.1.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","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.1.tar.gz
Algorithm Hash digest
SHA256 84db582c39c53aabf9ec0abc96627ee119cdcf9bfa540805f696872373644e02
MD5 cafa9f04dce0bf058b356a42468e69e9
BLAKE2b-256 327aa5cff8e03b7e7c964ee6062106cbdc07feb7b878959a864cec44ede6d82b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mongo_oidc_human_callback-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2efaa68d49877be5496bff50d32dd6ec21b5b4b2614be41dd34949c42372e54a
MD5 92cf55e3acac46b34f456c5e9eb08223
BLAKE2b-256 88cf6d1b4e286b9e16e7a53e8561a1c7909cb98226f9236e8ebd71ad23283529

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