akira.k
(ak)
June 30, 2020, 9:38am
1
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);
?>
tommy
(Tommy Gaessler)
July 1, 2020, 9:57pm
2
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
akira.k
(ak)
July 2, 2020, 12:30am
3
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
tommy
(Tommy Gaessler)
July 6, 2020, 6:47pm
4
Hey @akira.k ,
You can’t update the expiration, but you can get a new access and refresh token:
Thanks,
Tommy
akira.k
(ak)
July 7, 2020, 1:27am
5
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
tommy
(Tommy Gaessler)
July 8, 2020, 10:32pm
6
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
akira.k
(ak)
July 14, 2020, 12:30am
7
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
tommy
(Tommy Gaessler)
July 15, 2020, 11:54pm
8
You are welcome!
Please let me know if you have additional questions!
-Tommy