Generating SDK Signature Python Sample Code Solution

I am migrating from Zoom JWT app to Zoom SDK app. The old signature functionality that I was using for the JWT app does not work for SDK app.

Here is the Zoom documentation for how to generate new signature for SDK app:

Unlike before, the docs do not have examples in other languages. I needed it for Python. I saw the question asked here among other places:


import jwt

SDK_KEY = "sdk"
SDK_SECRET = "secret"

iat = 1675980580
exp = iat + 60 * 60 * 2

oHeader = { "alg": 'HS256', "typ": 'JWT' }

oPayload = {
  "sdkKey": SDK_KEY,
  "mn": 123,
  "role": 0,
  "iat": iat,
  "exp": exp,
  "tokenExp": exp

jwtEncode = jwt.encode(

This gave me same token as when I executed with Zooms node example:

# eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZGtLZXkiOiJzZGsiLCJtbiI6MTIzLCJyb2xlIjowLCJpYXQiOjE2NzU5ODA1ODAsImV4cCI6MTY3NTk4Nzc4MCwidG9rZW5FeHAiOjE2NzU5ODc3ODB9.HRbG3IfjRw72dbaE7SgxO4uchOBFWdOZm46QKVXHy94
# eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZGtLZXkiOiJzZGsiLCJtbiI6MTIzLCJyb2xlIjowLCJpYXQiOjE2NzU5ODA1ODAsImV4cCI6MTY3NTk4Nzc4MCwidG9rZW5FeHAiOjE2NzU5ODc3ODB9.HRbG3IfjRw72dbaE7SgxO4uchOBFWdOZm46QKVXHy94```

I’m doing something like this

#pip3 install pyjwt
import jwt
import hashlib
import hmac
import base64
import time
def generateSignature(data,secret):
    encoded_jwt = jwt.encode(data, secret, algorithm="HS256")
    return (encoded_jwt);
if __name__ == '__main__':
    epoch_time = int(time.time())
    CLIENT_SECRET="enter your client Secret here"
    CLIENT_ID="enter your client ID here"
    data = { "appKey": CLIENT_ID,
             "iat": epoch_time, 
             "exp": epoch_time_48hours_later, 
             "tokenExp": epoch_time_48hours_later,
    print (generateSignature(data,CLIENT_SECRET))