Beispiel #1
0
 def test_enable_nts(self):
     scat = AccessToken(SIGNING_KEY_SID, ACCOUNT_SID, 'secret')
     scat.enable_nts()
     token = str(scat)
     assert_is_not_none(token)
     payload = decode(token, 'secret')
     self._validate_claims(payload)
     assert_equal(1, len(payload['grants']))
     assert_equal('https://api.twilio.com/2010-04-01/Accounts/AC123/Tokens.json',
                  payload['grants'][0]['res'])
     assert_equal(['POST'], payload['grants'][0]['act'])
Beispiel #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()