# Cannot download recording

**URL:** <https://devforum.zoom.us/t/cannot-download-recording/22594>\
**Category:** API and Webhooks\
**Created:** [June 28, 2020, 6:28pm UTC](https://devforum.zoom.us/t/cannot-download-recording/22594 "2020-06-28T18:28:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![karasiov](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/karasiov/32/11135_2.png) [@karasiov](https://devforum.zoom.us/u/karasiov)\
**Post date:** [June 28, 2020, 6:28pm UTC](https://devforum.zoom.us/t/cannot-download-recording/22594/1 "2020-06-28T18:28:33Z")

</div>

```
include "vendor/autoload.php";
use \Firebase\JWT\JWT;
$key = " *********";
$payload = array(
"iss" => " ******",
"exp" => time()+36000,
);

$jwt = JWT::encode($payload, $key, 'HS256'); 

$curl = curl_init();
$d = "https://us02web.zoom.us/rec/download/ABCDEFGH?access_token=".$jwt;
curl_setopt_array($curl, array(
  CURLOPT_URL => $d,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTPHEADER => array(
"authorization: Bearer {$jwt}",
"content-type: application/json"
  ), ));

$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

```

This script works well with zoom api. I can read anything I need. But when I try to download file by download\_link, using JWT token (as in script). I get

`{"status":false,"errorCode":401,"errorMessage":"Forbidden"}` message

What I do wrong? Thank you.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [June 29, 2020, 10:49pm UTC](https://devforum.zoom.us/t/cannot-download-recording/22594/2 "2020-06-29T22:49:37Z")

</div>

Hey @karasiov,

Please try removing your authorization bearer header, and only use the `?access_token=jwt` method of authentication.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![karasiov](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/karasiov/32/11135_2.png) [@karasiov](https://devforum.zoom.us/u/karasiov)\
**Post date:** [June 30, 2020, 7:01pm UTC](https://devforum.zoom.us/t/cannot-download-recording/22594/3 "2020-06-30T19:01:31Z")

</div>

I did it, thank you very much!

below is example which worked for me:

> **Summary**
>
> ```
> <?    
> include "vendor/autoload.php";    
> use \Firebase\JWT\JWT;    
> $payload = array(    
> "iss" => API_KEY,    
> "exp" => time()+36000,     
> );    
> $jwt = JWT::encode($payload, API_SECRET, 'HS256');    
> $url = "https://us02web.zoom.us/rec/download/ABCDEFGH?access_token=".$jwt;    
> get_file($url);    
> function get_file($url){    
> $f = fopen("file.mp4", "w");    
> $curl = curl_init();    
> curl_setopt_array($curl, array(    
> CURLOPT_URL => $url,    
> CURLOPT_RETURNTRANSFER => true,    
> CURLOPT_ENCODING => "",    
> CURLOPT_MAXREDIRS => 10,    
> CURLOPT_TIMEOUT => 600, //!!! Do not forget about file size    
> CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,    
> CURLOPT_CUSTOMREQUEST => "GET",    
> CURLOPT_FOLLOWLOCATION => true,    
> CURLOPT_FILE => $f));    
> $response = curl_exec($curl);    
> $err = curl_error($curl);    
> curl_close($curl);    
>     
> if ($err) {    
> echo "cURL Error #:" . $err;
> exit();    
> }    
> fclose($f);    
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [July 1, 2020, 10:19pm UTC](https://devforum.zoom.us/t/cannot-download-recording/22594/4 "2020-07-01T22:19:36Z")

</div>

Happy to hear that fixed it! 🙂

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 10:32pm UTC](https://devforum.zoom.us/t/cannot-download-recording/22594/5 "2020-08-21T22:32:16Z")

</div>


