I have added the client id and secrete key and if i am autharizing the app from postman its working but as soon as i tried to ping the api with my app it giving 401 error.
how can i authorize my app into zoom app and can create meeting with dynamic token
authrization_url = 'https://zoom.us/oauth/authorize'
authrization_params = {
'client_id': zoom_client_key,
'response_type': 'code',
'redirect_uri': 'https://gensproject.supporthives.com/zoom',
}
auth_response = requests.post(authrization_url, data=authrization_params)
if auth_response:
# Obtain a new access token
access_token_url = 'https://zoom.us/oauth/token'
access_token_params = {
'grant_type': 'client_credentials',
'client_id': zoom_client_key,
'client_secret': zoom_client_secret,
}
try:
response = requests.post(access_token_url, data=access_token_params)
response.raise_for_status()
access_token = response.json().get('access_token', '')
except requests.RequestException as e:
return Response({'message': 'Failed to obtain access token', 'error': str(e)}, status=500)
# Create a Zoom meeting
# user_id = "ops@supporthives.com"
# create_meeting_url = f"https://api.zoom.us/v2/users/{user_id}/meetings"
"https://zoom.us/oauth/authorize?client_id=MeGkVnUrQGG15c7ESPP1ZA&response_type=code&redirect_uri=https%3A%2F%2Fgensproject.supporthives.com%2Fzoom"
create_meeting_url = 'https://api.zoom.us/v2/users/me/meetings'
create_meeting_headers = {
'Authorization': f'Bearer {access_token}',
# 'Authorization': f'Bearer eyJzdiI6IjAwMDAwMSIsImFsZyI6IkhTNTEyIiwidiI6IjIuMCIsImtpZCI6IjQ0NTYzNTg5LTA0YzAtNDY1ZC05NjBhLTljM2Y4YmI1ZjRmMyJ9.eyJ2ZXIiOjksImF1aWQiOiJiOTg4ZGQ4ZGNiYmQ0NTcyMjM0OWU4ZWE1ZGQ5NTVkMCIsImNvZGUiOiJ6V0tvUWhBREtuQWRHdVVuRkt5Uk15WXF2TjBYaXpDa0EiLCJpc3MiOiJ6bTpjaWQ6TWVHa1ZuVXJRR0cxNWM3RVNQUDFaQSIsImdubyI6MCwidHlwZSI6MCwidGlkIjowLCJhdWQiOiJodHRwczovL29hdXRoLnpvb20udXMiLCJ1aWQiOiI3RkRIdW16TFNMZW5xUVk0cDRFNDRnIiwibmJmIjoxNzExNDUyMTk0LCJleHAiOjE3MTE0NTU3OTQsImlhdCI6MTcxMTQ1MjE5NCwiYWlkIjoiMVpmNnBDYkRROHF2emU1RFB0VnQ0USJ9.2oTMkSwL0OrnOAswTJoscy8zOSJhVmplTHsE6gh3H5-z_7sznAanBF2XyL3wO9FLGpggsFSqWxB04MXQof7YDw',
'Content-Type': 'application/json',
}
event_datetime = datetime.combine(event.event_date, datetime.min.time())
start_time_utc = mktime(event_datetime.utctimetuple())
create_meeting_params = {
'topic': event.event_title,
'type': 2, # Scheduled meeting
'start_time': f'{start_time_utc}000',
'duration': 60,
'timezone': 'UTC',
'description': event.event_description,
'settings': {
'host_video': True,
'participant_video': True,
'waiting_room': False,
'join_before_host': True,
'mute_upon_entry': False,
'auto_recording': 'none',
},
}
try:
create_meeting_response = requests.post(create_meeting_url, headers=create_meeting_headers, json=create_meeting_params)
create_meeting_response.raise_for_status()
meeting_link = create_meeting_response.json().get('join_url', '')
event.event_link = meeting_link
event.event_meeting_data = create_meeting_response.json()
event.save()
# return success(201, meeting_link, "Meeting created successfully")
except requests.RequestException as e:
return fail(500 ,'Failed to create meeting error ' + str(e))
else:
return fail(400,"Zoom App not autharized!")
here is my code in which i am geting error again and again
how can i authorize this app. what will be correct way to generate meeting link dynamically