ZoomPhone Call Recording Fetching issue

Hi Team,

We are trying to fetch the ZoomPhone call recordings using the Admin’s access token, but we are getting 401.

The app we have developed is Account Level - OAuth app
We are using the valid access token to fetch the recording (admin users access token)

Please me know if need to any specific information about the call to debug the case.

Hi @phonebridge-integ
Thanks for reaching out to us, I am happy to help here!
Could you please share with me what endpoint are you trying to reach?
and what error are you getting?

Hello @elisa.zoom

Thanks for the reply. Please find the request details below, and the time of issue occurred was 1685578666834

https://zoom.us/v2/phone/recording/download/8SH78eMmSciaU0KdsqxSUQ?access_token=eyJzdiI6IjAwMDAwMSIsImFsZyI6IkhTNTEyIiwidiI6IjIuMCIsImtpZCI6Ijc2MDU4NGJiLWQ5ZWQtNDAxNi1hMDAxLWFjYTdiOWNiMGRmMyJ9.eyJ2ZXIiOjksImF1aWQiOiI3MTZlNDNmYzZmNWNjYWIxY2RjODgyM2EyNGQzZWMzNSIsImNvZGUiOiJld0hjVENDQXdkN1JmaG9BQ2REUkhhNTBLSThNSVZmZkEiLCJpc3MiOiJ6bTpjaWQ6NDVhbEI1NmlTVzJhdnBURXZKNUV4QSIsImdubyI6MCwidHlwZSI6MCwidGlkIjoxLCJhdWQiOiJodHRwczovL29hdXRoLnpvb20udXMiLCJ1aWQiOiJCR192ellJZFJDZUdYeEx0UlJsWFpRIiwibmJmIjoxNjg1MTI4OTQ4LCJleHAiOjE2ODUxMzI1NDgsImlhdCI6MTY4NTEyODk0OCwiYWlkIjoiUEJPY1RpZDlUaDZhVkVkblMxMGpvZyJ9.K7Aj-MAzjmosYvHHrB_XWrBWikrM4A9gNmZnyCMa9b8XsjC2V_Or0RqosLJPQpLgNgnP__f_C-qVep93GLLYuA

Thanks @phonebridge-integ
Could you please share with me what error are you getting? or what issue are you running into?

Hi Team,

Apologies for the delayed response.

Please find the complete details below,

Request URL : https://zoom.us/v2/phone/recording/download/x-dKp4gTQNKGwYzC9MVD0A?access_token={{ACCESS_TOKEN}}

HTTP Status Code : 400

Response Body : {“code”:401,“message”:“Invalid access token, this access token is not supported as query parameter string.”}

FYI: The access token sent in the request is newly created access token.

Hi Team,

Could we get any updates for the above issue.?

Hi @phonebridge-integ
Thanks for reaching out to us
We recently made some changes to the way we handle access_tokens and those should not be passed down as a query parameter anymore

In your request, try to pass this value in your authorization headers, as Bearer token

Hello @elisa.zoom ,

We have made the required changes at our end. We are passing the token in header and param as well.

Do we need to remove the token from the param itself.?

Hi Team,
I am writing code in nestjs. And for downloading phone call recording I have used res.redirect() with res.header(‘authorization’, ‘bearer token’);
but getting error
{
“code”: 124,
“message”: “Access token is required.”
}

hi @mshanmugam145
How are you generating the access token that you are passing in your request?

I have created server-O-auth app in zoom market place and using this

type or paste code here
https://zoom.us/oauth/token?grant_type=account_credentials&account_id={account_id}
const headersRequest = { Authorization: `Basic ${basicToken}` };

These are the API request I am sending and I am getting access_token. → This is working fine.

But For downloading zoom call recording -
When I directly call that download_url with bearer token → working fine in postman.
But If I used in our application to download that - please find the below code for ref.

Controller:

  @Public()
  @Get('phone/recording/:id')
  async redirectToAudioFile(
    @Res() res: express.Response,
    @Req() req: express.Request,
    @Param('id') id: string,
  ) {
    const audioUrl = https://zoom.us/v2/phone/recording/download/{id}
    // here I am using the above generation of token --> working fine. 
    const { access_token } = await this.zoomService.getAuthToken();
    // res.header('Authorization', `Bearer ${access_token}`);
    // res.header({ Authorization: `Bearer ${access_token}` });
    // res.set('Authorization', `Bearer ${access_token}`);
    // res.set({ Authorization: `Bearer ${access_token}` });
    // res.setHeader('Authorization', `Bearer ${access_token}`);
    // console.log(res);
    // req.('Authorization', 'Bearer my_token');
    res.removeHeader('Authorization');
    res.header('Authorization', `Bearer ${access_token}`);
    res.redirect(303, audioUrl);
  }

When I hit this request in postman - getting this below error

{
“code”: 124,
“message”: “Access token is required.”
}

Make sure that you are passing the access_token as a bearer token in your authorization method in postman
You can refer to this post here:

Access_token generation is working.
Working scenarios - If I directly send a request in postman

URL - https://zoom.us/v2/phone/recording/download/2VHN0SLpThmOFEp84HNVDQ
Authorization - "Bearer token"

Not working —

  @Public()
  @Get('phone/recording/:id')
  async redirectToAudioFile(
    @Res() res: express.Response,
    @Req() req: express.Request,
    @Param('id') id: string,
  ) {
    const audioUrl = https://zoom.us/v2/phone/recording/download/{id}
    // here I am using the above generation of token --> working fine
    const { access_token } = await this.zoomService.getAuthToken();
    res.header('Authorization', `Bearer ${access_token}`);
    res.redirect(303, audioUrl);
  }

Here I am using redirect with res.header(). As per my understanding,this res.header() this is not appending with res.redirect().

Hi @mshanmugam145
Can you share with me what endpoint are you using to get the call recording?

are you using this endpoint?

Hi @elisa.zoom
https://zoom.us/v2/phone/recording/download/{rec_id}
e.g:
https://zoom.us/v2/phone/recording/download/2VHN0SLpThmOFEp84HNVDQ

This url is coming from the event that whenever “phone_call_recording_completed”
triggered and within the payload as “download_url”

Thanks,
Shanmugam

You will have to generate an Oauth access token and pass it as the bearer token to download the recording.
The download_token included in the webhook response expires within 24 hours

Hi @elisa.zoom ,
This below API is used to get the access token for authorization header.

https://zoom.us/oauth/token?grant_type=account_credentials&account_id={account_id}
const headersRequest = { Authorization: Basic ${basicToken} };

Is this correct ?

Thanks,
Shanmugam

Here is a link to our Docs on how to generate an access token using Server to Server

Hi @elisa.zoom ,
Yes I am using this one only for generating “access_token”.
Everything looks correct, here

res.header('Authorization', `Bearer ${access_token}`);
res.redirect(303, download_url);

In this redirect, this header authorization is not accepting in ZOOM.
This is actual issue. Bcoz the error I am getting as

{
“code”: 124,
“message”: “Access token is required.”
}

This means that zoom not getting token.
I am coding in nestJs.

Please let me know if your getting my issue/problem.

Thanks,
Shanmugam.