Creating a KS with an AppToken gives an INVALID_APP_TOKEN_HASH even though the token is correct

apptokenstartsession
apptokenadd

#1

Hi Guys, so I’m trying to create a KS with an appToken but I’m not able to, right now I’m using the API try out options that you guys provide through the documentation (no code so far), I’m going to list the steps here and the results that I’m getting.

  • Create an AppToken with appToken.add, this works as expected.
  • I tried creating the token with sessionType as ADMIN / USER (both of them gave me the same results when trying to create the KS).
  • The privileges I’m using when creating the token are: sview:*,list:*,download:*, not sure if this really matter because the creation process of the token pass successfully.
  • Example of the response I get from creating the appToken:
{
  "id": "0_o7l19k80",
  "token": "f973211b7115b849cc0b5",
  "partnerId": 2422451,
  "createdAt": 1537206876,
  "updatedAt": 1537206876,
  "status": 2,
  "expiry": 1637206833,
  "sessionType": 2,
  "sessionDuration": 3600,
  "sessionPrivileges": "sview:*,list:*,download:*",
  "hashType": "SHA256",
  "description": "Jo's local app token",
  "objectType": "KalturaAppToken"
}
  • After this I try to use appToken.startSession with id (being the token id) and tokenHash (being the token attribute).
  • The response I get is this:
{
  "code": "INVALID_APP_TOKEN_HASH",
  "message": "Invalid application token hash",
  "objectType": "KalturaAPIException",
  "args": []
}

What I expect is getting a successful KS. Help here would be much appreciate.

Thanks.


#2

Hi @joseph_arrieta,

Please find full code samples here:
https://developer.kaltura.com/workflows/Generate_API_Sessions/App_Token_Authentication;step=1

If you happen to be developing in Python, you may find this thread easier to follow:

If, after reviewing these, you’re still having issues, please post your full code and I’ll gladly take a look.

Thanks,


#3

Hi @jess, your guidelines helped me in figuring out what was wrong in my code. Just a minor recommendation, it would be nice if you guys have an example that doesn’t use your client libraries, that way people like me (using Go, a language which you guys don’t provide a client library) is easier for us to follow the steps for creating a Kaltura Session through an AppToken.

Thanks.