0
import requests
import json
import jwt
import datetime

APİ_KEY = "100 percent correct api key"
APİ_SECRET = "100 percent correct api secret"

payload = {
'iss':APİ_KEY,
'exp':datetime.datetime.now() + datetime.timedelta(hours=2)
}
token = jwt.encode(payload, APİ_SECRET)
print(token)
endpoint = "https://api.zoom.us/v2/users/my_e-mail_is_written_here/meetings"
myData = {
    "headers": {
        "authorization":"Bearer "+token,
        "content-type":"application/json"
    },
    "body": {
        "topic":"denemex",
        "type":2,
        "start_time":"2021-05-05T13:20",
        "duration":"40",
        "password":"1234"
    }
}
zoom_r = requests.post(endpoint, data=json.dumps(myData))
print(zoom_r.status_code)
print(zoom_r.text)

I wanted to do a simple experiment with python like this, but I get an "invalid acces token" error, what could be the reason?

Sems
  • 11
  • 3

1 Answers1

0

I thought a little more about my problem and solved the problem by changing the code as follows:

import requests
import json
import jwt
import datetime

APİ_KEY = "my api key"
APİ_SECRET = "my api secret"

payload = {
'iss':APİ_KEY,
'exp':datetime.datetime.now() + datetime.timedelta(hours=2)
}
token = jwt.encode(payload, APİ_SECRET)
endpoint = "https://api.zoom.us/v2/users/my_e-mail_is_written_here/meetings"
myData = {
    "topic":"denemex",
    "type":2,
    "start_time":"2021-05-05T13:20",
    "duration":"40",
    "password":"1234"
}
headers = {"Content-Type":"application/json", "Authorization":"Bearer "+ token}
zoom_r = requests.post(endpoint, headers=headers, data=json.dumps(myData))
print(zoom_r.status_code)
print(zoom_r.text)
Sems
  • 11
  • 3