def load_auth_token(token, load=True):
assert get_config().jwt_secret, "<STR_LIT>"<EOL>assert get_config().jwt_issuer, "<STR_LIT>"<EOL>assert get_config().jwt_audience, "<STR_LIT>"<EOL>log.info("<STR_LIT>" % (<EOL>get_config().jwt_issuer,<EOL>get_config().jwt_audience,<EOL>get_config().jwt_secret[<NUM_LIT:1>:<NUM_LIT:8>],<EOL>))<EOL>issuer = get_config().jwt_issuer<EOL>try:<EOL><INDENT>headers = jwt.get_unverified_header(token)<EOL><DEDENT>except jwt.DecodeError:<EOL><INDENT>raise AuthInvalidTokenError('<STR_LIT>')<EOL><DEDENT>log.debug("<STR_LIT>" % headers)<EOL>if '<STR_LIT>' in headers:<EOL><INDENT>issuer = headers['<STR_LIT>']<EOL><DEDENT>log.info("<STR_LIT>" % issuer)<EOL>try:<EOL><INDENT>payload = jwt.decode(<EOL>token,<EOL>get_config().jwt_secret,<EOL>audience=get_config().jwt_audience,<EOL>leeway=<NUM_LIT><EOL>)<EOL><DEDENT>except jwt.ExpiredSignature:<EOL><INDENT>raise AuthTokenExpiredError('<STR_LIT>')<EOL><DEDENT>except jwt.InvalidAudienceError:<EOL><INDENT>raise AuthInvalidTokenError('<STR_LIT>')<EOL><DEDENT>except jwt.DecodeError:<EOL><INDENT>raise AuthInvalidTokenError('<STR_LIT>')<EOL><DEDENT>except jwt.InvalidIssuedAtError:<EOL><INDENT>raise AuthInvalidTokenError('<STR_LIT>')<EOL><DEDENT>payload['<STR_LIT>'] = token<EOL>payload['<STR_LIT>'] = issuer<EOL>if load:<EOL><INDENT>stack.top.current_user = payload<EOL><DEDENT>return payload<EOL>
Validate an auth0 token. Returns the token's payload, or an exception
    of the type: