Skip to content

Instantly share code, notes, and snippets.

@chsh
Created April 1, 2021 13:50
Show Gist options
  • Save chsh/27f49868aa3a1e8c95ac2a392f4780d1 to your computer and use it in GitHub Desktop.
Save chsh/27f49868aa3a1e8c95ac2a392f4780d1 to your computer and use it in GitHub Desktop.
Zoom Video SDK client signature generator.
require 'jwt'
def generate_instant_token(topic, password: '')
sdk_key = ENV['ZOOM_SDK_KEY']
sdk_secret = ENV['ZOOM_SDK_SECRET']
iat = Time.now.to_i
exp = iat + 60 * 60 * 2
payload = {
app_key: sdk_key,
iat: iat,
exp: exp,
tpc: topic,
pwd: password
}
JWT.encode payload, sdk_secret,
'HS256', { typ: 'JWT' }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment