def create_custom_token(uid, valid_minutes=60):
 client_email = app_identity.get_service_account_name()
 now = int(time.time())
 payload = base64.b64encode(json.dumps({'iss': client_email, 'sub': client_email, 'aud': _IDENTITY_ENDPOINT, 'uid': uid, 'iat': now, 'exp': (now + (valid_minutes * 60))}))
 header = base64.b64encode(json.dumps({'typ': 'JWT', 'alg': 'RS256'}))
 to_sign = '{}.{}'.format(header, payload)
 return '{}.{}'.format(to_sign, base64.b64encode(app_identity.sign_blob(to_sign)[1]))

def create_custom_token ( uid , valid_minutes = 60 ) : client_email = app_identity . get_service_account_name ( ) now = int ( time . time ( ) ) payload = base64 . b64encode ( json . dumps ( { 'iss' : client_email , 'sub' : client_email , 'aud' : _IDENTITY_ENDPOINT , 'uid' : uid , 'iat' : now , 'exp' : ( now + ( valid_minutes * 60 ) ) } ) ) header = base64 . b64encode ( json . dumps ( { 'typ' : 'JWT' , 'alg' : 'RS256' } ) ) to_sign = '{}.{}' . format ( header , payload ) return '{}.{}' . format ( to_sign , base64 . b64encode ( app_identity . sign_blob ( to_sign ) [ 1 ] ) )
create a secure token for the given id .