In a python (backend) and javascript (frontend) based application I was using jwt app to generate zoom meeting. So as jwt is deprecated now I want to implement Server-to-Server OAuth/ OAuth app to create zoom meeting.
Please check the below code and let me know where is the issue that not working and which type app should be make .
import requests
import json
import base64
# The Zoom client ID and client secret
client_id = "CLIENT ID"
client_secret = "CLIENT SECRET"
# The URL of the Zoom OAuth token endpoint
url = "https://zoom.us/oauth/token"
# The request body
payload = {
"grant_type": "client_credentials"
}
# The request headers
headers = {
"Authorization": "Basic " + base64.b64encode(f"{client_id}:{client_secret}".encode()).decode()
}
# Make the request to the Zoom OAuth token endpoint
response = requests.post(url, headers=headers, data=payload)
# Check the response status code
if response.status_code == 200:
# The request was successful, get the access token
access_token = response.json()["access_token"]
print("access token is", access_token)
else:
# The request failed, raise an exception
raise Exception("Failed to get access token")
# The topic of the meeting
topic = "My Meeting"
# The duration of the meeting in minutes
duration = 30
# The start time of the meeting in ISO 8601 format
start_time = "2023-09-10T13:00:00Z"
# The URL of the Zoom API endpoint to create a meeting
url = "https://api.zoom.us/v2/users/me/meetings"
# The request headers
headers = {
"Authorization": f"Bearer {access_token}"
}
# The request body
payload = {
"topic": topic,
"duration": duration,
"start_time": start_time
}
# Make the request to create the meeting
response = requests.post(url, headers=headers, data=payload)
# Check the response status code
if response.status_code == 200:
# The request was successful, get the meeting ID
meeting_id = response.json()["id"]
print(f"Meeting created successfully, meeting ID: {meeting_id}")
else:
# The request failed, raise an exception
raise Exception("Failed to create meeting")
This code is working for creating token but at the end it’s not creating the meeting link . Error 400. If anyone have solved it please share. Advance thanks.