Last active
April 13, 2020 17:17
-
-
Save joshuawoodward/929e1743036a9512692c1c02c606d04d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//using composer | |
require __DIR__ . '/vendor/autoload.php'; | |
// JWT PHP Library https://github.com/firebase/php-jwt | |
use \Firebase\JWT\JWT; | |
//function to generate JWT | |
function generateJWT () { | |
//Zoom API credentials from https://developer.zoom.us/me/ | |
$key = '<zoom_api_key>'; | |
$secret = '<zoom_api_secret>'; | |
$token = array( | |
"iss" => $key, | |
// The benefit of JWT is expiry tokens, we'll set this one to expire in 1 minute | |
"exp" => time() + 60 | |
); | |
return JWT::encode($token, $secret); | |
} | |
function getUsers () { | |
//list users endpoint GET https://api.zoom.us/v2/users | |
$ch = curl_init('https://api.zoom.us/v2/users'); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
// add token to the authorization header | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array( | |
'Authorization: Bearer ' . generateJWT() | |
)); | |
$response = curl_exec($ch); | |
$response = json_decode($response); | |
return $response; | |
} | |
var_dump(getUsers()); |
Hola joshuawoodward, me podrias ayudar implementando correctamente este ejemplo en mi aplicación, actualmente estoy desarrollando una app en php 5 con codeigniter y deseo implementar zoom para la realización de reuniones, como primer paso quisiera saber como implementar este ejemplo de listar los usuarios, ya tengo el api key y el secret pero al parecer faltan archivos para implementar este ejemplo como el autoload.php y tambien quisiera saber como instalar el JWT de firebase con el composer para que se adapte a mi proyecto.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
composer.json
{ "require" : { "firebase/php-jwt" : "^5.0" } }