{"id":7820,"library":"types-auth0-python","title":"Typing stubs for auth0-python","description":"This is a type stub package for the `auth0-python` library, providing static type annotations that can be used by type checkers like MyPy or Pyright. It helps ensure type safety and improves IDE autocompletion for code interacting with the Auth0 Python SDK. This version of `types-auth0-python` aims to provide accurate annotations for `auth0-python==4.10.*`. It is part of the typeshed project, which releases frequently (often several times a month) to keep up with runtime library changes.","status":"active","version":"4.10.0.20260408","language":"en","source_language":"en","source_url":"https://github.com/python/typeshed","tags":["typing","stubs","auth0","typeshed","type-checking"],"install":[{"cmd":"pip install types-auth0-python","lang":"bash","label":"Install typing stubs"}],"dependencies":[{"reason":"Provides type hints for this runtime library. Not a runtime dependency, but a type-checking dependency.","package":"auth0-python","optional":false}],"imports":[{"note":"The `ManagementClient` is the recommended way to interact with the Auth0 Management API since `auth0-python` v5.0.0. The `auth0.v3` path is deprecated.","wrong":"from auth0.v3.management import Auth0","symbol":"ManagementClient","correct":"from auth0.management import ManagementClient"},{"note":"Used for obtaining access tokens via authentication flows.","symbol":"GetToken","correct":"from auth0.authentication import GetToken"},{"note":"Used for verifying ID tokens.","symbol":"TokenVerifier","correct":"from auth0.authentication.token_verifier import TokenVerifier"},{"note":"The base class for API errors changed with `auth0-python` v5.0.0.","wrong":"from auth0.exceptions import Auth0Error","symbol":"ApiError","correct":"from auth0.management.errors import ApiError"}],"quickstart":{"code":"import os\nfrom auth0.management import ManagementClient\nfrom auth0.management.users import Users\nfrom typing import Dict, Any\n\n# Ensure environment variables are set for actual use\nAUTH0_DOMAIN: str = os.environ.get('AUTH0_DOMAIN', 'your-tenant.auth0.com')\nAUTH0_CLIENT_ID: str = os.environ.get('AUTH0_CLIENT_ID', 'YOUR_CLIENT_ID')\nAUTH0_CLIENT_SECRET: str = os.environ.get('AUTH0_CLIENT_SECRET', 'YOUR_CLIENT_SECRET')\n\n# Initialize the ManagementClient with client credentials for automatic token management\n# This client is fully type-hinted by types-auth0-python\nmanagement_client: ManagementClient = ManagementClient(\n    domain=AUTH0_DOMAIN,\n    client_id=AUTH0_CLIENT_ID,\n    client_secret=AUTH0_CLIENT_SECRET\n)\n\n# Access a sub-client, e.g., for users management\nusers_client: Users = management_client.users\n\n# Example: List users (response types are Pydantic models in v5, but can be dicts too)\ntry:\n    # Use .all() for pagination convenience or .get_all() if you need more control\n    all_users: list[Dict[str, Any]] = users_client.get_all()\n    print(f\"Found {len(all_users)} users.\")\n    if all_users:\n        print(f\"First user ID: {all_users[0].get('user_id')}\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize the `ManagementClient` from `auth0-python` (version 5.0.0+), which is fully typed by `types-auth0-python`. It fetches the domain, client ID, and client secret from environment variables and then lists all users using the `users` sub-client. The example shows how type hints from `types-auth0-python` would apply to client initialization and method calls, aiding static analysis."},"warnings":[{"fix":"Refer to the `auth0-python` v5 migration guide and update import paths, client instantiation, and how response data is accessed (e.g., use `.model_dump()` to convert Pydantic models to dictionaries if needed).","message":"The `auth0-python` library underwent a major rewrite in v5.0.0, introducing significant breaking changes. This includes changes to import paths (e.g., `from auth0.management import Auth0` is now `from auth0.management import ManagementClient`), client initialization, and response types (now Pydantic models instead of generic dictionaries).","severity":"breaking","affected_versions":"auth0-python < 5.0.0 to 5.0.0+"},{"fix":"Always install `types-auth0-python` with a version compatible with your `auth0-python` installation. Check the `types-auth0-python` PyPI page for the supported `auth0-python` version range. Pin both packages if necessary (e.g., `auth0-python~=4.10.0` and `types-auth0-python==4.10.0.YYYYMMDD`).","message":"Mismatching versions of `types-auth0-python` and `auth0-python` can lead to incorrect type checking or errors. The stub package aims to provide accurate annotations for specific `auth0-python` versions (e.g., `4.10.*`).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your Python environment meets the minimum requirement for the `auth0-python` version you are using. Update Python if necessary.","message":"`auth0-python` has increased its minimum Python version requirement. For example, v5 requires Python >=3.9, and v5.2.0 dropped support for Python 3.8. Using older Python versions with newer `auth0-python` (and thus `types-auth0-python`) can cause runtime errors or `SyntaxError` with type hints.","severity":"breaking","affected_versions":"auth0-python < 3.9 / 3.10 / 3.11"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Change the import to `from auth0.management import ManagementClient` and update the client instantiation accordingly.","cause":"The `Auth0` class was removed/renamed in `auth0-python` v5.0.0.","error":"ImportError: cannot import name 'Auth0' from 'auth0.management'"},{"fix":"Access attributes directly (e.g., `user.user_id`) or convert the Pydantic model to a dictionary using `.model_dump()` (e.g., `user.model_dump().get('user_id')`) if dictionary-like access is desired.","cause":"In `auth0-python` v5.0.0, many API responses are now Pydantic models instead of plain dictionaries, particularly for Management API calls.","error":"AttributeError: 'dict' object has no attribute 'user_id' (or similar for Pydantic model methods)"},{"fix":"Ensure `types-auth0-python` is installed and its version is compatible with your `auth0-python` version. Run your type checker with verbose output to confirm which stubs are being used. You may need to update `auth0-python` or `types-auth0-python`.","cause":"Your type checker might be using an outdated stub version or `types-auth0-python` is not correctly installed/recognized for your `auth0-python` version.","error":"error: Library \"auth0-python\" has no attribute \"management\" (or similar type checker error)"}]}