Sha256: d2411492dae6f0bced22715ed608ae2f88ecd5a21ac255c18f32b46c926a75be

Contents?: true

Size: 508 Bytes

Versions: 2

Compression:

Stored size: 508 Bytes

Contents

require 'rubygems'
require 'plivo'

include Plivo

AUTH_ID = 'MADADADADADADADADADA'
AUTH_TOKEN = 'AUTH_TOKEN'

begin
  acctkn = Plivo::Token::AccessToken.new(
    AUTH_ID,
    AUTH_TOKEN,
    '{username}',
    '{uid}'
  )
  # update token validity (from, lifetime, till)
  acctkn.update_validity(Time.now, 300)
  # add voice grants (incoming, outgoing)
  acctkn.add_voice_grants(Plivo::Token::VoiceGrants.new(true, true))
  puts acctkn.to_jwt
rescue ValidationError => e
  puts 'Exception: ' + e.message
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plivo-4.8.1 examples/jwt.rb
plivo-4.8.0 examples/jwt.rb