def _validate_request_code( self, code, client_id):
nonce = self.data_store.fetch( '<STR_LIT>', code=code )<EOL>if not nonce:<EOL><INDENT>raise Proauth2Error( '<STR_LIT>', '<STR_LIT>' % code )<EOL><DEDENT>if client_id != nonce['<STR_LIT>']: <EOL><INDENT>raise Proauth2Error( '<STR_LIT>', '<STR_LIT>' % code )<EOL><DEDENT>user_id = nonce['<STR_LIT>']<EOL>expires = nonce['<STR_LIT>']<EOL>self.data_store.remove( '<STR_LIT>', code=code, client_id=client_id,<EOL>user_id=user_id )<EOL>if time() > expires:<EOL><INDENT>raise Proauth2Error( '<STR_LIT>', '<STR_LIT>' % code )<EOL><DEDENT>return user_id<EOL>
_validate_request_code - internal method for verifying the the given nonce.
also removes the nonce from the data_store, as they are intended for
one-time use.