IGWN Auth Utils
raw JSON → 1.4.0 verified Mon Apr 27 auth: no python
Authorisation utilities for the IGWN (International Gravitational-Wave Observatory Network). Provides token management, scitoken creation/validation, and authentication helpers. Current version 1.4.0, released May 2025. Active development, monthly releases.
pip install igwn-auth-utils Common errors
error ModuleNotFoundError: No module named 'igwn_auth_utils' ↓
cause Installed old version (<1.0.0) with different package name.
fix
Upgrade to latest version: pip install --upgrade igwn-auth-utils
error ValueError: Invalid token: not a valid JWT ↓
cause Token string is malformed or uses wrong algorithm.
fix
Ensure token is a valid JWT and check that you're using the correct public key.
error requests.exceptions.HTTPError: 401 Client Error: Unauthorized ↓
cause Client credentials or token URL are incorrect.
fix
Double-check client_id, client_secret, and token_url environment variables.
Warnings
breaking Version 1.0.0 changed import paths from `igwn.auth_utils` to `igwn_auth_utils`. ↓
fix Update imports to use underscores.
deprecated `create_authorization_header` is deprecated in 1.2.0+ in favor of `get_access_token`. ↓
fix Use `get_access_token` which returns a token object with a `header` property.
gotcha Scitoken validation requires the `audience` parameter to match exactly; mismatches cause silent failures. ↓
fix Verify the audience claim in the token matches the expected value.
Imports
- get_access_token wrong
from igwn.auth_utils import get_access_tokencorrectfrom igwn_auth_utils import get_access_token - create_scitoken
from igwn_auth_utils.scitokens import create_scitoken
Quickstart
import os
from igwn_auth_utils import get_access_token
token = get_access_token(
token_url=os.environ.get('IGWN_TOKEN_URL', 'https://example.com/token'),
client_id=os.environ.get('IGWN_CLIENT_ID', ''),
client_secret=os.environ.get('IGWN_CLIENT_SECRET', '')
)
print(f'Token: {token[:20]}...')