Registry / auth-security / onelogin

onelogin

JSON →
library4.0.0pypypi✓ verified 83d ago

Official Python SDK for the OneLogin API (v1 and v2). Supports OAuth2 authentication, user and role management, event and factor APIs, and SAML assertion handling. Current version 3.2.5, requires Python >=3.10. Active development with quarterly releases.

pip install onelogin
INSTALL
IMPORT
SIG · ONELOGIN
O
onelogin
auth-securitypythonv4.0.0
Install
4.0s avg
Import
Disk
37MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 34.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.0s · import 0.000s · 34MB
37MB installed
● package 37MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ApiClient
from onelogin import ApiClient
from onelogin.api.client import OneLoginClient

Initialize the OneLogin client and fetch a list of users.

import os from onelogin.api.client import OneLoginClient client = OneLoginClient( client_id=os.environ.get('ONELOGIN_CLIENT_ID', ''), client_secret=os.environ.get('ONELOGIN_CLIENT_SECRET', ''), region='us' ) # Fetch users users = client.get_users() print(f"Fetched {len(users)} users")
Debug
Known issues
breakingIn v3.x, the constructor changed from (region, client_id, client_secret) to (client_id, client_secret, region). Passing positional arguments in the old order will swap credentials.
fix
Use keyword arguments: OneLoginClient(client_id=..., client_secret=..., region='us')
affects: >=3.0.0
deprecatedMethods like create_user() are deprecated in favor of create_user2(). The v2 endpoints return different response structures.
fix
Use create_user2() and handle the User model returned.
affects: >=2.0.0 <4.0.0
gotchaThe library uses Pydantic v2 for data models. Direct dictionary access on responses may fail if you expected simple dicts.
fix
Access attributes via dot notation (e.g., user.email) rather than user['email'].
affects: >=3.0.0
gotchaOAuth2 access tokens expire after 3600 seconds. The client does not auto-refresh – you must call client.refresh_token() or re-authenticate.
fix
Wrap API calls with token expiry check or call authenticate() before each batch.
affects: all
breakingIn v2.0.0, the SDK was rewritten to support both API /1 and /2. Old v1 SDK scripts (pre-2.0) are not compatible.
fix
Migrate to the new client and use v2 endpoints where possible.
affects: >=2.0.0
Upgrade
Version history
4.0.0latest on PyPI · released May 12, 2026
Audit
Dependencies
requestsrequiredHTTP client used by all API calls
pydanticrequiredData models for API responses (v2)
cryptographyoptionalSAML assertion signing/verification
Agent activity
22 hits · last 30 days
node
18
Amazon
1
OpenAI (training)
1
Resources
onelogin — pip install onelogin · libregistry