How to Create a Kaltura Session

Printer-friendly version

The Kaltura API is REST based and stateless. Every call (request) made to the Kaltura API requires an authentication key, the Kaltura Session (aka KS), identifying the account on which the action to be carried, the authenticated user and its role.

A Kaltura Session can be initiated in 3 different ways:

  1. Calling the session.start action, providing the account Partner ID and an Admin or User secret key.
    $ks = $client->session->start ($adminSecret, $anyUserName, KalturaSessionType::ADMIN, $partnerId);  
    $client->setKS($ks);
  2. Calling the user.loginByLoginId action, providing a User login ID (email), its Password and the account Partner ID.
    $ks = $client->user->loginByLoginId($loginId, $password, $partnerId);  
    $client->setKS($ks);
  3. Creating a session locally - Combine all the Kaltura Session details, and sign them using the shared secret.
    $ks = $client->generateSession($adminSecret, $userId, $type, $partnerId);  
    $client->setKS($ks);

The above examples are using the Kaltura PHP5 Client Library.

 

Important Security Notes:

  1. ADMIN type KS provides super admin priveliges to the Kaltura account. If you're creating an application where the session will be exposed to the end-user, make sure that you are using a USER type KS and not ADMIN type. Exposing an ADMIN type KS in non-administrative context will expose your Kaltura account to risks of being used by malicious users with unrestricted access.
  2. Sharing the account API secret keys with 3rd party vendors should be avoided, as secret keys can not be regenerated or blocked for access. Kaltura API based application developers and 3rd party application vendors should build their application to leverage the user.loginByLoginId API and ask the publisher for their email, password and account Id (aka partnerId). Users can be easily created, removed or blocked and their password can easily be changed. 

 

To learn more about the KS and its usage read: Kaltura's API Authentication and SecurityThe Kaltura Session.

Note: To use the Kaltura API, you will need a Publisher Account with API access. Start a free Kaltura.com trial or download Kaltura CE.

FAQ Type: 
(40713 reads)