Skip to main content

A lightweight tool to fetch Azure AD access tokens.

Project description

token-service-toolcase

token-service-toolcase is a lightweight and developer-friendly Python utility designed to fetch OAuth2 access tokens from Azure Active Directory (Azure AD) using the Client Credentials flow.

This package is ideal for microservices, backend applications, internal tools, automation scripts, or any environment where a secure and minimal method of retrieving access tokens is required—without bringing in heavy Azure SDK dependencies.


Features

  • ✔ Minimal API surface — easy to integrate
  • ✔ Stateless: no environment variable dependency
  • ✔ No Azure CLI or SDK required
  • ✔ Pure Python implementation using requests
  • ✔ Consistent error handling with clear messages
  • ✔ Fully unit-tested (mocked, no network calls)
  • ✔ Compatible with serverless functions, containers, and CI/CD pipelines

Installation

Install the latest version from PyPI:

pip install token-service-toolcase

Usage

from token_service_toolcase import TokenService

service = TokenService(
    client_id="YOUR_CLIENT_ID",
    client_secret="YOUR_CLIENT_SECRET",
    tenant_id="YOUR_TENANT_ID",
    scope="https://graph.microsoft.com/.default",
    token_url=f"https://login.microsoftonline.com/YOUR_TENANT_ID/oauth2/v2.0/token",
    grant_type="client_credentials"
)

access_token = service.get_access_token()
print("Access Token:", access_token)

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

token_service_toolcase-0.1.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

token_service_toolcase-0.1.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file token_service_toolcase-0.1.0.tar.gz.

File metadata

  • Download URL: token_service_toolcase-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for token_service_toolcase-0.1.0.tar.gz
Algorithm Hash digest
SHA256 63c9efdae84631eed2d4f05c9e27be5826b05697ea2437d8c921a4dd6f4cff1e
MD5 ab7c9177f3c2723102a239bd74ef387a
BLAKE2b-256 c1b847e9a18f3a2a82757f4877eb85029e1670b8771aba498cbf8c7a1d14ccd1

See more details on using hashes here.

File details

Details for the file token_service_toolcase-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for token_service_toolcase-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 53ca266e29c3ee48f26978d7a994259c99eef66769dd8a6de6488dafc6c72da3
MD5 171d1fac6da4be2f8ed624f7ecd27140
BLAKE2b-256 c31dd30c2d8365f244eb73223ea2cf0f2dafe3fbb587c5867d32a9d7688eddad

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