Python SDK
The distribution name is axis-iam-vertex; the import namespace is axis_vertex.
Install the recorded source commit with Python 3.12 or newer. The package is not currently published to PyPI.
To keep tokens on your application backend, use the optional BFF server-session integration. The existing examples below retain their browser-token/Bearer behavior.
Install from source
python -m pip install "axis-iam-vertex[fastapi] @ git+https://github.com/axis-iam/vertex-sdk-python.git@8a692da6f726442e6603cdd07b9f9322001a0e41"
Use the django extra for Django, or omit extras for the core client.
FastAPI quickstart
import os
from contextlib import asynccontextmanager
from fastapi import Depends, FastAPI
from axis_vertex import IamClient, IamConfig
from axis_vertex.fastapi import require_permission
iam = IamClient(IamConfig(
endpoint=os.environ["IAM_ENDPOINT"],
client_id=os.environ["IAM_CLIENT_ID"],
client_secret=os.environ["IAM_CLIENT_SECRET"],
resource_audience=os.environ["IAM_RESOURCE_AUDIENCE"],
))
@asynccontextmanager
async def lifespan(app: FastAPI):
yield
await iam.close()
app = FastAPI(lifespan=lifespan)
@app.get("/orders", dependencies=[Depends(require_permission(iam, "orders", "read"))])
async def list_orders() -> dict[str, list[object]]:
return {"orders": []}
Use a WEB/M2M confidential ApplicationClient. Keep its secret server-side and close the async client during application shutdown. Authentication, network, and decode failures deny access.
Map the configuration from Portal as follows:
| Environment variable | Portal source |
|---|---|
IAM_ENDPOINT | Vertex public Auth URL |
IAM_CLIENT_ID | This API's WEB/M2M confidential client ID |
IAM_CLIENT_SECRET | The same server client's write-only secret |
IAM_RESOURCE_AUDIENCE | Application resource audience |
The browser SPA has a different public client ID and no secret. IamClient verifies incoming user access tokens and
uses the confidential client to resolve current permissions; it fails closed on authentication, network, and decode
errors.
Resource server and management boundary
Use require_permission for incoming user requests. Use PortalOpenApiClient only for backend management automation,
with a separate M2M client and the exact scopes required by each operation. Close both async clients during application
shutdown and never expose M2M credentials to browser code.
Reference
The reference is produced by Python's native documentation inspection from the package's explicit public exports.