When authenticated via token, I cannot retrieve the list of entries

Hello :slight_smile:
I can authenticate with a SHA256 token, that has an ADMIN session type and these privileges: "“disableentitlement, list, download, sview, downloadasset, sviewplaylist”
However, whenever I call client.media_service.list (I am using the Ruby client), I receive the following response with 0 objects: #<Kaltura::KalturaMediaListResponse:0x000056265f005a10 @objects=nil, @related_objects=nil, @total_count=0>.
I can get single videos though with client.media_service.get(entry_id).
It seems to me it is pretty much an issue with permissions, but so far I haven’t been able to get around them…Any idea?
Thank you for your support in advance,

Hi @annacostalonga ,

I’d say something is wrong with the privileges value. Either the one passed when generating the session or the one set on the appToken object (appToken.sessionPrivileges).
First, check the sessionPrivileges value on the token and make sure it is what you expect to be. Secondly, if you have a token where the sessionType is ADMIN and you set the privileges to disableentitlement, you don’t need to set any additional privileges; a valid KS generated with that privilege can already perform any operation on that partner.

Hello Jess again,
I think I figured out why…I did not set the ks after starting the privileged session with the app_token.

res = client.app_token_service.start_session(token_id, token_hash, session_user_id, session_type, expiry, session_privileges)

I think that somehow the ks of the session was still the one set by the widget session? Could that be the case?
Now I can retrieve all the videos in my account.
Thanks a lot!

Hi @annacostalonga ,

As I noted in my reply to here https://forum.kaltura.org/t/creating-a-ks-with-an-apptoken-gives-an-invalid-app-token-hash-even-though-the-token-is-correct/8539/7:

res = client.app_token_service.start_session(token_id, token_hash, user_id, type, expiry, session_privileges);
# res.ks should now be assigned to the client so it can make requests


1 Like