def generate_token(key, iat=None, exp_delta=timedelta(minutes=5), typ='player', tid=None, uid='00000000-0000-0000-0000-000000000000'):
    'Generate a JSON Web Token'
    if (iat is None):
        iat = datetime.utcnow()
    if (tid is None):
        tid = str(uuid4())
    return jwtlib.encode({'iss': 'webapi', 'sub': 'webgames', 'iat': iat, 'exp': (iat + exp_delta), 'jti': tid, 'typ': typ, 'uid': uid}, key, algorithm='HS256').decode()
Generate a JSON Web Token
def generate_token(key, iat=None, exp_delta=timedelta(minutes=5), typ='player', tid=None, uid='00000000-0000-0000-0000-000000000000'):
    
    if (iat is None):
        iat = datetime.utcnow()
    if (tid is None):
        tid = str(uuid4())
    return jwtlib.encode({'iss': 'webapi', 'sub': 'webgames', 'iat': iat, 'exp': (iat + exp_delta), 'jti': tid, 'typ': typ, 'uid': uid}, key, algorithm='HS256').decode()