$ pip install mbq.tokens
🚀✨
Guaranteed fresh.
from mbq import tokens
tokens.init(
certificate=settings.FORMATTED_CERTIFICATE,
allowed_audiences=set(settings.ALLOWED_AUDIENCES),
)
try:
decoded_token = tokens.decode(token)
except tokens.TokenError:
# will only ever raise TokenError
logger.exception('Failed to decode token')
decoded_token = tokens.decode_header(request.META['HTTP_AUTHORIZATION'])