twilio.jwt package

Module contents

class twilio.jwt.Jwt(secret_key, issuer, subject=None, algorithm=None, nbf=<object object>, ttl=3600, valid_until=None)[source]

Bases: object

Base class for building a Json Web Token

ALGORITHM = 'HS256'
GENERATE = <object object>
algorithm = None
classmethod from_jwt(jwt, key='')[source]

Decode a JWT string into a Jwt object :param str jwt: JWT string :param Optional[str] key: key used to verify JWT signature, if not provided then validation

is skipped.

:raises JwtDecodeError if decoding JWT fails for any reason. :return: A DecodedJwt object containing the jwt information.

headers
issuer = None
nbf = None
payload
secret_key = None
subject = None
to_jwt(ttl=None)[source]

Encode this JWT object into a JWT string :param int ttl: override the ttl configured in the constructor :rtype: str The JWT string

ttl = None
valid_until = None
exception twilio.jwt.JwtDecodeError[source]

Bases: Exception