User Tools

Site Tools


Authentication and authorization

vCDN supports different levels of access:

  • - full access: the customer name is used as login
  • - limited access: login has the form “customername-sublogin” (e.g. megatube-file), access to API is configured for each sublogin individually.

For example, you can create a separate account to work with files only or with access to statistics only.

The API has a tree-like structure: /class/action (or /class/action/specific in some cases) - for limited logins you can deny/allow access to the branch as a whole or to its single element.
A more specific rule has priority - you can deny access to /file/delete, even if access to the /file/ branch is allowed.

Currently, two authentication methods are supported:

  • - login/password
  • - otp (one time password)


Regular plain HTTP authentication. You can request the API directly in browser (for example, read the documentation for a specific call).

In scripts, you can use URLs like (if traffic interception is a cause of concern, it is recommended to use https, but you can use http to decrease the delay).
Or, you can use special options or environment variables to specify the login/password for the appropriate utilities (wget, curl, ..)
Or you can generate Authentication HTTP-header and transmit it while executing an API- request:

# LOGIN=customer-role
# PASS=qwerty
# AUTH=`echo -n "$LOGIN:$PASS" | base64 -e`
# wget -O - --header='Accept-Encoding: *,gzip' --header="Authorization: Basic $AUTH" ''

OTP (one time password)

The token is sent as a GET or POST request parameter to the API query.

After verification, it is stored (saved to the cache) and next queries using it will be rejected.

OTP has the following form:

  • LOGIN - login, with full access or restricted one. It is important to have a PASSWORD corresponding to this login. It will used too.
  • EXPIRE - GMT timestamp of expiration time of OTP.
  • SALT - salt, any set of string characters.
  • AUTH - MD5 hash value of the string “EXPIRE:SALT:PASSWORD”

Example of API query with OTP,status&filter_full_name=1/2/345.flv

Example of OTP generation

  function api_otp() {
  $LOGIN = 'login';
  $PASSWORD = 'password';
  $EXPIRE = time() + 300;
  $rnd_str = '';
  for ($i=1; $i&lt;=6; $i++) {
    $rnd_str = $rnd_str . chr(rand(0,255));
  $SALT = strtr(base64_encode($rnd_str), '/', ',');
  return "$LOGIN:$EXPIRE:$SALT:$AUTH";
en/api_authentification.txt · Last modified: 2018/11/07 16:52 by zuborg