Example #1
0
 def test_endpoint_grant(self):
     scat = AccessToken(SIGNING_KEY_SID, ACCOUNT_SID, 'secret')
     scat.add_endpoint_grant('bob')
     token = str(scat)
     assert_is_not_none(token)
     payload = decode(token, 'secret')
     self._validate_claims(payload)
     assert_equal(1, len(payload['grants']))
     assert_equal('sip:[email protected]',
                  payload['grants'][0]['res'])
     assert_equal(['listen', 'invite'], payload['grants'][0]['act'])
Example #2
0
from twilio.access_token import AccessToken

# You will need your Account Sid and a SigningKey Sid and Secret
# to generate an Access Token for your SDK endpoint to connect to Twilio.

account_sid = "{{ account_sid }}"
signingkey_sid = SID
signingkey_secret = SECRET

token = AccessToken(signingkey_sid, account_sid, signingkey_secret)
token.add_endpoint_grant(ENDPOINT_ADDRESS)
token.enable_nts()
print token.to_jwt()