Skip to content

Build the Auth-Token header

To build the auth_token, you can use the following code:

import hashlib
from datetime import datetime
from base64 import b64encode

unix_timestamp = str(datetime.now().timestamp())[:10]
uniq_token_string = secret_key + unix_timestamp
uniq_token_hash = hashlib.sha256(
    uniq_token_string.encode("ascii"),
).hexdigest()
auth_token = b64encode(
    bytes((
        f"{access_key};"
        f"{unix_timestamp};"
        f"{uniq_token_hash}"
    ),
    "ascii",
    )
)
base64_str = auth_token.decode("ascii")