Refresh Token issue in oauth zoom api

Hello, I am using OAuth token to schedule meeting using zoom api. But after 1 hour access token expired and when I try to generate new access token with old refresh token It gives the following issue:

Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: POST https://zoom.us/oauth/token resulted in a 401 Unauthorized response: {“reason”:“Invalid Token!”,“error”:“invalid_request”}

I am working in PHP.

Hey @marketing4

Thanks for posting on the Zoom Devforum! I am still learning, but I will try my best to help answer your question. :slightly_smiling_face:

Checkout these related threads that may have the answer you are looking for:

If these threads did not help, please let us know by replying back here and someone from the Developer Relations team will get back to you shortly.

Thanks,
DeveloperBot

Hi ,
these threads are not working for me. i am getting this issue last 1 one week. please reply asap.

Hi ,
Please reply asap.

Hi @marketing4,

Please reference these steps for refreshing a token:

Note that the latest refresh token must always be used for the next refresh request.

Let me know if this helps,
Will

Hi will,

I have done all these things but its not working for me.

this is my code

$refresh_token = $db->get_refersh_token();

        $client = new GuzzleHttp\Client(['base_uri' => 'https://zoom.us']);
        $response = $client->request('POST', '/oauth/token', [
            "headers" => [
                "Authorization" => "Basic ".base64_encode(CLIENT_ID.':'.CLIENT_SECRET)
            ],
            'form_params' => [
                "grant_type"=>"refresh_token",
                "refresh_token"=>$refresh_token
            ],
            
        ]);
       
         $db->update_access_token($response->getBody());

getting the error

Fatal error : Uncaught GuzzleHttp\Exception\ClientException: Client error: POST https://zoom.us/oauth/token resulted in a 401 Unauthorized response: {“reason”:“Invalid Token!”,“error”:“invalid_request”} in /var/www/html/skilrock-zoom-final/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:111 Stack trace: #0 /var/www/html/skilrock-zoom-final/vendor/guzzlehttp/guzzle/src/Middleware.php(66): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response)) #1 /var/www/html/skilrock-zoom-final/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Response)) #2 /var/www/html/skilrock-zoom-final/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), NULL) #3 /var/www/html/skilrock-zoom-final/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}() #4 /var/www/html/skilrock-zoom-final/v in /var/www/html/skilrock-zoom-final/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 111

i am getting this error in postman

Did you solve this error?

No,you have any solution to fix this issue.

Hey @marketing4,

I just DM’d you—can you reply to my message with the requested value so that I can help debug?

Thanks,
Will

where can i see your DM’d ?

Hey @marketing4,

You should have received an email or be able to view a DM from the top right hand side of your Forum account/dropdown menu.

If you still have trouble seeing the DM, you can send us an email at developersupport@zoom.us. Please include the value you’re passing for your authorization header with us either of these places (do not post this here, as this contains sensitive credentials). This will help us to debug!

Thanks,
Will

Hi,

In response to your question:

FOR Access Token:

“headers” => [
“Authorization” => "Basic ". base64_encode(CLIENT_ID.’:’.CLIENT_SECRET)
],
‘form_params’ => [
“grant_type” => “authorization_code”,
“code” => $_GET[‘code’],
“redirect_uri” => REDIRECT_URI
],

FOR Refesh Token:

“headers” => [
“Authorization” => "Basic ". base64_encode(CLIENT_ID.’:’.CLIENT_SECRET)
],

‘form_params’ => [
“grant_type” => “refresh_token”,
“refresh_token” => $refresh_token
],

Thanks,
Atul

Hi,

Please respond so that we can close this issue.

Thanks,
Ankur

Hi @marketing4,

Thanks for sharing this. I’m not seeing any issues with your Authorization headers. I think there is likely still an issue with the refresh_token value you’re passing in the form_params for your refresh request.

Can you please send us an email to developersupport@zoom.us with the values you’re passing for your refresh_token? We should be able to check our logs to look into this further. Please do not share this here, as these are sensitive details.

Thanks,
Will