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
Release history Release notifications | RSS feed
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63c9efdae84631eed2d4f05c9e27be5826b05697ea2437d8c921a4dd6f4cff1e
|
|
| MD5 |
ab7c9177f3c2723102a239bd74ef387a
|
|
| BLAKE2b-256 |
c1b847e9a18f3a2a82757f4877eb85029e1670b8771aba498cbf8c7a1d14ccd1
|
File details
Details for the file token_service_toolcase-0.1.0-py3-none-any.whl.
File metadata
- Download URL: token_service_toolcase-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53ca266e29c3ee48f26978d7a994259c99eef66769dd8a6de6488dafc6c72da3
|
|
| MD5 |
171d1fac6da4be2f8ed624f7ecd27140
|
|
| BLAKE2b-256 |
c31dd30c2d8365f244eb73223ea2cf0f2dafe3fbb587c5867d32a9d7688eddad
|