我正在尝试使用带有OAuth方法的 API 将 Zoom 与我的 CodeIgneter 应用程序集成。我创建了一个访问令牌并成功地将我的 Zoom 帐户与我的应用程序集成。1 小时后,Zoom 帐户访问密钥过期。在 Zoom API 文档中,它说 1 小时后访问令牌将过期,之后我们可以使用Refresh Token生成访问令牌。
使用的文档: OAuth 文档:-
我正在创建一个函数来使用刷新令牌在过期后创建访问令牌。
我的代码是:
$clients = new GuzzleHttp\Client(['base_uri' => 'https://zoom.us']);
$arr_tokens = $this->get_access_token();
$refresh_tokens = $arr_tokens->refresh_token;
$response = $clients->request('POST', '/oauth/token', [
"headers" => [
"Authorization" => "Basic Q2xpZW50X0lEOkNsaWVudF9TZWNyZXQ=". base64_encode(CLIENT_ID.':'.CLIENT_SECRET)
],
'form_params' => [
"grant_type" => "refresh_token",
"refresh_token" => $refresh_tokens
],
]);
这里$refresh_tokens 有我的刷新令牌。CLIENT_ID和CLIENT_SECRET是我的客户端 ID 和客户端密钥。我正在尝试此代码并打印响应。但反应和我预期的不一样。没有访问令牌或刷新令牌。
预期响应:
{
"access_token": "eyJhbGciOiJIUzUxMiIsInYiOiIyLjAiLCJraWQiOiI8S0lEPiJ9.eyJ2ZXIiOiI2IiwiY2xpZW50SWQiOiI8Q2xpZW50X0lEPiIsImNvZGUiOiI8Q29kZT4iLCJpc3MiOiJ1cm46em9vbTpjb25uZWN0OmNsaWVudGlkOjxDbGllbnRfSUQ-IiwiYXV0aGVudGljYXRpb25JZCI6IjxBdXRoZW50aWNhdGlvbl9JRD4iLCJ1c2VySWQiOiI8VXNlcl9JRD4iLCJncm91cE51bWJlciI6MCwiYXVkIjoiaHR0cHM6Ly9vYXV0aC56b29tLnVzIiwiYWNjb3VudElkIjoiPEFjY291bnRfSUQ-IiwibmJmIjoxNTgwMTQ3Mzk0LCJleHAiOjE1ODAxNTA5OTQsInRva2VuVHlwZSI6ImFjY2Vzc190b2tlbiIsImlhdCI6MTU4MDE0NzM5NCwianRpIjoiPEpUST4iLCJ0b2xlcmFuY2VJZCI6MjZ9.5c58p0PflZJdlz4Y7PgMIVCrQpHDnbM565iCKlrtajZ5HHmy00P5FCcoMwHb9LxjsUgbJ7653EfdeX5NEm6RoA",
"token_type": "bearer",
"refresh_token": "eyJhbGciOiJIUzUxMiIsInYiOiIyLjAiLCJraWQiOiI8S0lEPiJ9.eyJ2ZXIiOiI2IiwiY2xpZW50SWQiOiI8Q2xpZW50X0lEPiIsImNvZGUiOiI8Q29kZT4iLCJpc3MiOiJ1cm46em9vbTpjb25uZWN0OmNsaWVudGlkOjxDbGllbnRfSUQ-IiwiYXV0aGVudGljYXRpb25JZCI6IjxBdXRoZW50aWNhdGlvbl9JRD4iLCJ1c2VySWQiOiI8VXNlcl9JRD4iLCJncm91cE51bWJlciI6MCwiYXVkIjoiaHR0cHM6Ly9vYXV0aC56b29tLnVzIiwiYWNjb3VudElkIjoiPEFjY291bnRfSUQ-IiwibmJmIjoxNTgwMTQ3Mzk0LCJleHAiOjIwNTMxODczOTQsInRva2VuVHlwZSI6InJlZnJlc2hfdG9rZW4iLCJpYXQiOjE1ODAxNDczOTQsImp0aSI6IjxKVEk-IiwidG9sZXJhbmNlSWQiOjI2fQ.DwuqOzywRrQO2a6yp0K_6V-hR_i_mOB62flkr0_NfFdYsSqahIRRGk1GlUTQnFzHd896XDKf_FnSSvoJg_tzuQ",
"expires_in": 3599,
"scope": "user:read" }
实际反应:
GuzzleHttp\Psr7\Response Object
[reasonPhrase:GuzzleHttp\Psr7\Response:private] => OK
[statusCode:GuzzleHttp\Psr7\Response:private] => 200
[headers:GuzzleHttp\Psr7\Response:private] => Array
(
[Date] => Array
(
[0] => Thu, 03 Sep 2020 12:58:09 GMT
)
[Content-Type] => Array
(
[0] => text/html;charset=utf-8
)
[Transfer-Encoding] => Array
(
[0] => chunked
)
[Connection] => Array
(
[0] => keep-alive
)
[Server] => Array
(
[0] => ZOOM
)
[x-zm-trackingid] => Array
(
[0] => WEB_af014e94c93acce064094d6fcc84cdcf
)
[X-Content-Type-Options] => Array
(
[0] => nosniff
)
[Content-Security-Policy] => Array
(
[0] => upgrade-insecure-requests; default-src https://*.zoom.us https://zoom.us https://d17o6on0vd932d.cloudfront.net blob: 'self'; script-src 'unsafe-eval' 'unsafe-inline' blob: about: https://ruanshi2.8686c.com https://ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js https://appsforoffice.microsoft.com https://assets.zendesk.com https://autocomplete.demandbase.com https://cdn.wootric.com https://cdncache-a.akamaihd.net https://connect.facebook.net https://consent.trustarc.com https://d.adroll.mgr.consensu.org https://d2b9h3rz4xo53c.cloudfront.net https://d24cgw3uvb9a9h.cloudfront.net https://googleads.g.doubleclick.net https://pi.pardot.com https://s.dcbap.com https://s.ytimg.com https://s3.amazonaws.com https://scout-cdn.salesloft.com https://sealserver.trustwave.com https://secure-cdn.mplxtms.com https://serve2.cheqzone.com https://snap.licdn.com https://sp.analytics.yahoo.com https://static.zdassets.com https://static2.sharepointonline.com https://tag.demandbase.com https://tpc.googlesyndication.com https://tracking.g2crowd.com https://trk.techtarget.com https://www.comeet.co https://www.dropbox.com https://www.google-analytics.com https://static.zoom.com.cn https://www.googleadservices.com/pagead/conversion_async.js https://www.googletagmanager.com/gtm.js https://optimize.google.com https://tagmanager.google.com https://www.gstatic.com/recaptcha/releases/ https://google.com https://docs.google.com https://cse.google.com https://maps.google.com https://www.google.com https://linkedin.com https://platform.linkedin.com https://px.ads.linkedin.com https://ads.linkedin.com https://www.youtube.com https://d17o6on0vd932d.cloudfront.net https://*.ada.support https://*.adroll.com https://*.hotjar.com https://*.zoom.us https://*.zoomcloudpbx.com https://*.zoomus.cn https://*.zopim.com https://adroll.com https://zoom.us https://apis.google.com https://gstatic.zoom.com.cn 'self'; img-src https: about: blob: data: 'self'; style-src https: safari-extension: chrome-extension: 'unsafe-inline' data: 'self'; font-src https: safari-extension: chrome-extension: blob: data: 'self'; connect-src * about: blob: data: 'self'; media-src * rtmp: blob: data: 'self'; frame-src https: ms-appx-web: zoommtg: zoomus: wvjbscheme: data: 'self'; object-src 'none'; base-uri 'none';
)
[X-FRAME-OPTIONS] => Array
(
[0] => SAMEORIGIN
)
[Set-Cookie] => Array
(
[0] => zm_aid=""; Domain=.zoom.us; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly
[1] => zm_haid=""; Domain=.zoom.us; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly
[2] => cred=21ABCC12B70F62365DDF0B554A35C671; Path=/; Secure; HttpOnly
[3] => _zm_page_auth=us02_c_uEv-kiHgQvKAAar4F_rPWQ; Domain=.zoom.us; Path=/; Secure; HttpOnly
[4] => _zm_ssid=us02_c_aKIgfweHQQG5EaT2cZpweg; Domain=.zoom.us; Path=/; Secure; HttpOnly
[5] => _zm_ctaid=f889E52dRvqoURUKV2vCUg.1599137889254.83389fb9b0d366fa454e83b4f1b894ec; Domain=.zoom.us; Expires=Thu, 03-Sep-2020 14:58:09 GMT; Path=/; Secure; HttpOnly
[6] => _zm_chtaid=493; Domain=.zoom.us; Expires=Thu, 03-Sep-2020 14:58:09 GMT; Path=/; Secure; HttpOnly
[7] => _zm_ctaid=bksezrrWSqOKKGvcxDRklA.1599137889254.5f69b5a447060faa456f1bb911caa7f1; Domain=.zoom.us; Expires=Thu, 03-Sep-2020 14:58:09 GMT; Path=/; Secure; HttpOnly
[8] => _zm_chtaid=651; Domain=.zoom.us; Expires=Thu, 03-Sep-2020 14:58:09 GMT; Path=/; Secure; HttpOnly
[9] => _zm_csp_script_nonce=RodE7nd0SZSuAxPkY_1tLw; Domain=.zoom.us; Path=/; Secure; HttpOnly
[10] => _zm_currency=USD; Domain=.zoom.us; Expires=Fri, 04-Sep-2020 12:58:09 GMT; Path=/; Secure
[11] => _zm_mtk_guid=3a7d99ffa1474d8e837f0d7a34d285de; Domain=.zoom.us; Expires=Sun, 01-Sep-2030 12:58:09 GMT; Path=/; Secure
)
[p3p] => Array
(
[0] => CP="NOI ADM DEV PSAi COM NAV OUR OTR STP IND DEM"
)
[Content-Language] => Array
(
[0] => en-US
)
[Strict-Transport-Security] => Array
(
[0] => max-age=31536000; includeSubDomains
)
[X-XSS-Protection] => Array
(
[0] => 1; mode=block
)
[Referrer-Policy] => Array
(
[0] => strict-origin-when-cross-origin
)
)
[headerNames:GuzzleHttp\Psr7\Response:private] => Array
(
[date] => Date
[content-type] => Content-Type
[transfer-encoding] => Transfer-Encoding
[connection] => Connection
[server] => Server
[x-zm-trackingid] => x-zm-trackingid
[x-content-type-options] => X-Content-Type-Options
[content-security-policy] => Content-Security-Policy
[x-frame-options] => X-FRAME-OPTIONS
[set-cookie] => Set-Cookie
[p3p] => p3p
[content-language] => Content-Language
[strict-transport-security] => Strict-Transport-Security
[x-xss-protection] => X-XSS-Protection
[referrer-policy] => Referrer-Policy
)
[protocol:GuzzleHttp\Psr7\Response:private] => 1.1
[stream:GuzzleHttp\Psr7\Response:private] => GuzzleHttp\Psr7\Stream Object
(
[stream:GuzzleHttp\Psr7\Stream:private] => Resource id #11
[size:GuzzleHttp\Psr7\Stream:private] =>
[seekable:GuzzleHttp\Psr7\Stream:private] => 1
[readable:GuzzleHttp\Psr7\Stream:private] => 1
[writable:GuzzleHttp\Psr7\Stream:private] => 1
[uri:GuzzleHttp\Psr7\Stream:private] => php://temp
[customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
(
)
)
如何解决这个问题…………????