Authentication

Last update:2026-07-15 17:46:03

When sending transcoding requests, you must include an authentication token in the Authorization header. This token is a security measure that ensures only authorized requests are processed.

Important: The token includes your AccessKey and is cryptographically signed using your AccessKey Secret. Make sure you have obtained your unique AccessKey and AccessKey Secret before proceeding.

Token Format

The authentication token uses the following format:

Token = [AccessKey]:[EncodeSign]

Where:

  • AccessKey: Your unique public identifier.
  • EncodeSign: A URL-safe Base64-encoded HMAC-SHA1 signature.

The process of generating the authentication token involves the following steps:

  1. Generate EncodeSign
  2. Construct the Token

The following sections describe each step in detail.

Step 1: Generate EncodeSign

EncodeSign is generated by applying a series of transformations to StringToSign and your AccessKey Secret.

EncodeSign = Urlsafe_base64_encode(HMAC_SHA1(StringToSign, AccessKey Secret))

The process is outlined below.

Formulate StringToSign

StringToSign is constructed based on the request type. For media processing requests, it uses the following format:

StringToSign = '/fops' + '\n' + [Request Body]
  • /fops: A fixed string that indicates the operation.
  • \n: A newline character.
  • [Request Body]: The body of your transcoding request.

If your Request Body is bucket=[bucket_name]key=[file_to_process]fops=[processing_operations], your StringToSign will be:

/fops\nbucket=[bucket_name]key=[file_to_process]fops=[processing_operations]

Note: The example Request Body shown here is the original string for clarity. In your actual request, you may use a Base64-encoded string.

Compute the Signature

After formulating StringToSign, use your AccessKey Secret as the key to compute the HMAC-SHA1 signature:

Signature = HMAC_SHA1(StringToSign, AccessKey Secret)

You can obtain your AccessKey and AccessKey Secret by navigating to Basic Information > Account Management > API Information Management > AccessKey Management.

Base64 Encode the Signature

Finally, apply URL-safe Base64 encoding to the computed Signature to obtain EncodeSign:

EncodeSign = Urlsafe_base64_encode(Signature)

Step 2: Create the Token

After generating EncodeSign and obtaining your AccessKey, combine them in the following format to create your authentication token:

Token = [AccessKey]:[EncodeSign]

This token must be included in the Authorization header of your transcoding requests.