module documentation

Service-account based bearer for asynchronous authentication.

Examples Constructing from an environment/CLI-backed reader (recommended):

>>> from nebius.aio.token.service_account import ServiceAccountBearer
>>> from nebius.base.service_account.pk_file import Reader as PKReader
>>> bearer = ServiceAccountBearer(PKReader("/path/to/private_key.pem"))

Constructing from explicit values (private key object required):

>>> from cryptography.hazmat.primitives.serialization import load_pem_private_key
>>> from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey
>>> with open("/path/to/private_key.pem","rb") as fh:
...     key = load_pem_private_key(fh.read(), password=None)
>>> bearer = ServiceAccountBearer(
...     "service-account-id",
...     private_key=key,  # type: RSAPrivateKey
...     public_key_id="public-key-id",
... )

The resulting bearer exposes the receiver method used by the SDK's authentication layer. See nebius.aio.token.token for the receiver and token abstractions.

Class ServiceAccountBearer Bearer that obtains tokens using a service account.