The access to service [media->list] is forbidden

Can anyone help take a loot what is wrong with my NodeJS code? returns error below. We use Kaltura SaaS.

“The access to service [media->list] is forbidden”

var kaltura = require(’./KalturaClient.js’);
var kalturaTypes = require(’./KalturaTypes.js’);
var vo = require(’./KalturaVO.js’)

var cb = function (results){

var partnerId = 188XXXX;
var conf = new kaltura.KalturaConfiguration(partnerId);
conf.serviceUrl = “”;

var client = new kaltura.KalturaClient(conf);

var secret = “adminsecretinKMC”;
var userId = “myemailaddress”;
var type = kalturaTypes.KalturaSessionType.ADMIN;

var expiry = 100000;
var privileges = null;
client.session.start(cb, secret, userId, type, partnerId, expiry, privileges);

var filter = new vo.KalturaMediaEntryFilter();

var filterAdvancedSearch = new vo.KalturaMetadataSearchItem();
filterAdvancedSearch.type = 2; //kaltura.KalturaSearchOperatorType.SEARCH_OR;
filterAdvancedSearch.metadataProfileId = 31;

var filterAdvancedSearchItems = new vo.KalturaSearchCondition();
filterAdvancedSearchItems.field = “/[local-name()=‘metadata’]/[local-name()=‘MediaType’]”; // MediaType is the system name is Custom Data in KMC
filterAdvancedSearchItems.value = ‘1’;

filterAdvancedSearch.items = [filterAdvancedSearchItems];
filter.advancedSearch = filterAdvancedSearch;{console.log(results);
}, filter, null);

Did you ever resolve this? I just ran into it as well, and am wondering what I’m doing wrong.


I’m not sure what the issue is in your case but in the code above, it is that setKs() is never called.
Should be something like:
var config = new KalturaConfiguration(partner_id);
config.serviceUrl = “”;
var client = new KalturaClient(config);
client.session.start(function(success, ks) {
if (!success || (ks.code && ks.message)) {
console.log(‘Error starting session’, success, ks);
console.log(ks.message || ‘Unknown Error’)
} else {

}, “secrethash”,

Also take a look at which is a good way to get started with the API.