#NEWLINE# def validate_short_term_login_token_and_get_user_id( self , login_token ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# macaroon = pymacaroons . Macaroon . deserialize ( login_token ) #NEWLINE# auth_api = self . hs . get_auth ( ) #NEWLINE# auth_api . validate_macaroon ( macaroon , 'login' , True ) #NEWLINE# return self . get_user_from_macaroon ( self ) #NEWLINE# #UNINDENT# except ( pymacaroons . exceptions . MacaroonException , TypeError , ValueError ) : #NEWLINE# #INDENT# raise AuthError ( 401 , 'Invalid token' , errcode = Codes . UNKNOWN_TOKEN )