speechkit.auth module

Utilities for Yandex Cloud authorisation IAM token Api-Key

speechkit.auth.generate_jwt(service_account_id, key_id, private_key, exp_time=360)[source]

Generating JWT token for authorisation

Parameters:
  • service_account_id (string) – The ID of the service account whose key the JWT is signed with.

  • key_id (string) – The ID of the Key resource belonging to the service account.

  • private_key (bytes) – Private key given from Yandex Cloud console in bytes

  • exp_time (integer) – Optional. The token expiration time delta in seconds. The expiration time must not exceed the issue time by more than one hour, meaning exp_time ≤ 3600. Default 360

Returns:

JWT token

Return type:

string

speechkit.auth.get_api_key(yandex_passport_oauth_token=None, service_account_id=None, description='Default Api-Key created by `speechkit` python SDK')[source]

Creates an API key for the specified service account.

Parameters:
  • yandex_passport_oauth_token (string) – OAuth token from Yandex OAuth

  • service_account_id (string) – The ID of the service account whose key the Api-Key is signed with.

  • description (string) – Description for api-key. Optional.

Returns:

Api-Key

Return type:

string

speechkit.auth.get_iam_token(yandex_passport_oauth_token=None, jwt_token=None)[source]

Creates an IAM token for the specified identity. Getting IAM for Yandex account

Parameters:
  • yandex_passport_oauth_token (string) – OAuth token from Yandex OAuth

  • jwt_token (string) – Json Web Token, can be generated by speechkit.generate_jwt()

Returns:

IAM token

Return type:

string