I’m using Zoom Ouath API to create a Zoom meeting. But when I hit the ADD APP URL to generate the token or authorization it’ll took me zoom error page Error - Zoom .
I have checked all the details are correct like Redirect URI, and Client ID. someone let me know what exactly happened did I do something wrong?
Here is my CODE:
/Authorization*************/
$clientId = ‘CLIENT ID’;
$redirectUri = ‘REDIRECT URL’;
$authorizationUrl = ‘Error - Zoom’ . http_build_query([
‘response_type’ => ‘code’,
‘client_id’ => $clientId,
‘redirect_uri’ => $redirectUri,
// ‘scope’ => ‘meeting:write:admin’, // Include the required scopes
]);
// Redirect the user to the Zoom authorization page
header('Location: ’ . $authorizationUrl);
exit;
/****Generate TOKEN/
<?php require_once 'vendor/autoload.php'; use GuzzleHttp\Client; use GuzzleHttp\Exception\ClientException; $clientId = 'CLIENT ID'; $clientSecret = 'CLIENT SECRET'; $redirectUri = 'REDIRECT URL'; // Initialize Guzzle client $client = new GuzzleHttp\Client(); // Validate against the state received in the authorization request $code = $_GET['code']; try { // Exchange the authorization code for an access token $tokenUrl = 'https://zoom.us/oauth/token'; $response = $client->request('POST', $tokenUrl, [ 'form_params' => [ 'grant_type' => 'authorization_code', 'code' => $code, 'redirect_uri' => $redirectUri, ], 'auth' => [$clientId, $clientSecret], ]); $tokenData = json_decode($response->getBody(), true); // Save the access token securely for future use $accessToken = $tokenData['access_token']; echo "Access Token: ".$accessToken.""; $response = $client->request('POST', 'https://api.zoom.us/v2/users/me/meetings', [ 'headers' => [ 'Authorization' => 'Bearer ' . $accessToken, 'Accept' => 'application/json', ], 'json' => [ 'topic' => 'Your Meeting Topic', 'type' => 2, // 2 for Scheduled Meeting 'start_time' => date('Y-m-d\TH:i:s\Z', strtotime('+1 day')), // Tomorrow's date 'duration' => 60, // Meeting duration in minutes ], ]); $meetingData = json_decode($response->getBody(), true); echo "Meeting ID: " . $meetingData['id'] . "
"; echo "Join URL: " . $meetingData['join_url']; } catch (ClientException $e) { // Handle the error echo 'Error: ' . $e->getMessage(); echo 'Response: ' . $e->getResponse()->getBody()->getContents(); } ?>