Get account recordings API Error

When we call this API, we always get a Authorization failed error.

We tried to recreate a jwt token just like this :
https://developers.zoom.us/docs/video-sdk/create/

but not working.

Hi @y-ka,

Thank you for reaching out on the Developer Forum.

If you are looking to invoke VSDK APIs, you should be referring to this documentation on creating Video SDK API JWT Make API requests.

The other link you referenced is for generating a JWT Token for Video SDK Authorization.

1 Like

We tried to get token use this method

require('dotenv').config();
const KJUR = require('jsrsasign')

export default function generateVideoSdkApiJwt() {

  const sdkApiKey = 'xxx';
  const sdkApiSecret = "xxxx";

  const iat = Math.round((new Date().getTime() - 30000) / 1000)
  const exp = iat + 60 * 60 * 2
  const oHeader = { alg: 'HS256', typ: 'JWT' }

  const oPayload = {
    iss: sdkApiKey,
    iat: iat,
    exp: exp
  }

  const sHeader = JSON.stringify(oHeader)
  const sPayload = JSON.stringify(oPayload)
  const videosdk_api_token = KJUR.jws.JWS.sign('HS256', sHeader, sPayload, sdkApiSecret)
  return videosdk_api_token
}

And we are sure to got a token string,
But When we call The API use this token,we got the same error:

Error: Request failed with status code 401

Could you please help me to research about it

We found these from the link you gave me

JWTs consist of three core parts: Header , Payload , and Signature . When combined, these parts are separated by a period to form a token: 1111111.2222222.3333333 .

So we fix the method like this:

require('dotenv').config();
const KJUR = require('jsrsasign')
const base64url = require('base64url');

export default function generateVideoSdkApiJwt() {

  const sdkApiKey = 'Jmoscb1Kdl1KxWuUsi0bX5DqlI9X2j9vpXpX';
  const sdkApiSecret = "CDmZIv1vWUNIm317SCv0V98UBkrkUs1fn0qz";

  const iat = Math.round((new Date().getTime() - 30000) / 1000)
  const exp = iat + 60 * 60 * 2
  const oHeader = { alg: 'HS256', typ: 'JWT' }

  const oPayload = {
    iss: sdkApiKey,
    exp: exp,
    iat: iat
  }

  const sHeader = JSON.stringify(oHeader)
  const sPayload = JSON.stringify(oPayload)
  const videosdk_api_token = KJUR.jws.JWS.sign('HS256', sHeader, sPayload, sdkApiSecret)

  const header = base64url(sHeader)
  const payload = base64url(sPayload)
  return header + '.' + payload + '.' + videosdk_api_token
}

But we got the same error:
Error: Request failed with status code 401

I wondered if you can help us.