Refresh access_token

OAuthで作成したaccess_tokenを以下のコードでrefreshしようとしています。エラーは出ていない様子ですが、有効期限が1時間から延長されませんでした。どこか間違っているのでしょうか?
I am trying to refresh the access_token created in OAuth with the following code. No error appears, but the expiration date was not extended from 1 hour. Is something wrong?

<?php
$basic = base64_encode({{※Client_ID※}} . ':' . {{※Client_Secret※}});
$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => "https://zoom.us/oauth/token?grant_type=refresh_token&refresh_token={{※refresh_token※}}",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => array(
        "authorization: Basic $basic"
    ),
));
    
$response = curl_exec($curl);
curl_close($curl);
?>

Hey @akira.k,

What do you mean it was not extended from 1 hour?

In the response you will get:

"expires_in": 3599

This mean it will expire in 3599 minutes after you receive it from the response.


1時間から延長されなかったとはどういう意味ですか?

応答では、次のようになります。

「expires_in」:3599
これは、応答から受け取った後3599分で有効期限が切れることを意味します。

Thanks,
Tommy

Hi, Tommy.

I expect a POST with a “grant_type=refresh_token&refresh_token=” URL to renew the expiration to 15 years.
(I want to update the expiration in PHP, what is the method?)

I am referring to the following “Refreshing an Access Token” article.
https://marketplace.zoom.us/docs/guides/auth/oauth

Thanks,
Akira

Hey @akira.k,

You can’t update the expiration, but you can get a new access and refresh token:

Thanks,
Tommy

Hi, @tommy

I want to get an access_token with the longest expiry time possible.
Does my PHP code above not give me an access_token with a 15 year expiration?

Or is there another way to get the Webinar schedule all the time?

Thanks,
Akira

Hey @akira.k,

Maybe the best solution would be to use a JWT Token and set the expiry to as long as you want.

However, we suggest generating a new one each use.

Thanks,
Tommy

Hi, @tommy.

I understand.
It seems that the purpose can be achieved by using JWT Token.

Thank you for your help.

Thanks,
Akira

1 Like

You are welcome! :slight_smile:

Please let me know if you have additional questions!

-Tommy