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: https://marketplace.zoom.us/docs/sdk/native-sdks/auth/#generate-the-sdk-jwt
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:
Solution:
https://pyjwt.readthedocs.io/en/stable/
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(
oPayload,
SDK_SECRET,
algorithm="HS256",
headers=oHeader,
)
This gave me same token as when I executed with Zooms node example:
# eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZGtLZXkiOiJzZGsiLCJtbiI6MTIzLCJyb2xlIjowLCJpYXQiOjE2NzU5ODA1ODAsImV4cCI6MTY3NTk4Nzc4MCwidG9rZW5FeHAiOjE2NzU5ODc3ODB9.HRbG3IfjRw72dbaE7SgxO4uchOBFWdOZm46QKVXHy94
# eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZGtLZXkiOiJzZGsiLCJtbiI6MTIzLCJyb2xlIjowLCJpYXQiOjE2NzU5ODA1ODAsImV4cCI6MTY3NTk4Nzc4MCwidG9rZW5FeHAiOjE2NzU5ODc3ODB9.HRbG3IfjRw72dbaE7SgxO4uchOBFWdOZm46QKVXHy94```