OneLogin API Python SDK
Maintained. Last release 5 months ago, commits in 3 of the last 26 weeks. Weaker on commit activity and security practices.
pip install oneloginonelogin-python-sdk
Official Python SDK for the OneLogin API. Manage users, roles, groups, apps, and authentication programmatically.
API reference: OneLogin API Documentation.
Per-endpoint docs: see docs/ in this repo.
Support
OneLogin by One Identity open-source projects are supported through GitHub. For help, please open an issue: https://github.com/onelogin/onelogin-python-sdk/issues. Requests filed via official One Identity Support are redirected here so all users can benefit.
Requirements
- Python 3.10+
- Pydantic 2.11+ (enforced via
pyproject.toml)
Installation
pip install onelogin
For development:
pip install -e ".[test,lint]"
Getting Started
import os
import onelogin
from pprint import pprint
configuration = onelogin.Configuration(
host="https://your-subdomain.onelogin.com",
username=os.environ["ONELOGIN_CLIENT_ID"],
password=os.environ["ONELOGIN_CLIENT_SECRET"],
)
with onelogin.ApiClient(configuration) as api_client:
# Exchange client credentials for an access token.
token_api = onelogin.OAuth2Api(api_client)
token = token_api.generate_token({"grant_type": "client_credentials"})
configuration.access_token = token.access_token
# Now make authenticated calls.
users_api = onelogin.UsersV2Api(api_client)
pprint(users_api.list_users2())
Authentication
OneLogin uses OAuth2 client credentials. Generate a Client ID + Client Secret under Security → API Credentials in the OneLogin admin portal, with one of:
- Authentication Only — Verify Factor, Generate SAML Assertion, Create Session Login Token, Log User Out
- Read Users —
GETon User, Role, Group resources - Manage Users —
GET/POST/PUT/DELETEon User, Role, Group (no password management or role assignment) - Read All — read-only across all resources
- Manage All — full access including password management and role assignment