def _verify(<EOL>self,<EOL>request,<EOL>return_payload=False,<EOL>verify=True,<EOL>raise_missing=False,<EOL>request_args=None,<EOL>request_kwargs=None,<EOL>*args,<EOL>**kwargs<EOL>):
try:<EOL><INDENT>token = self._get_token(request)<EOL>is_valid = True<EOL>reason = None<EOL><DEDENT>except (<EOL>exceptions.MissingAuthorizationCookie,<EOL>exceptions.MissingAuthorizationQueryArg,<EOL>exceptions.MissingAuthorizationHeader,<EOL>) as e:<EOL><INDENT>token = None<EOL>is_valid = False<EOL>reason = list(e.args)<EOL>status = e.status_code if self.config.debug() else <NUM_LIT><EOL>if raise_missing:<EOL><INDENT>if not self.config.debug():<EOL><INDENT>e.status_code = <NUM_LIT><EOL><DEDENT>raise e<EOL><DEDENT><DEDENT>if token:<EOL><INDENT>try:<EOL><INDENT>payload = self._decode(token, verify=verify)<EOL>if verify:<EOL><INDENT>if self._extra_verifications:<EOL><INDENT>self._verify_extras(payload)<EOL><DEDENT>if self._custom_claims:<EOL><INDENT>self._verify_custom_claims(payload)<EOL><DEDENT><DEDENT><DEDENT>except (<EOL>jwt.exceptions.ExpiredSignatureError,<EOL>jwt.exceptions.InvalidIssuerError,<EOL>jwt.exceptions.ImmatureSignatureError,<EOL>jwt.exceptions.InvalidIssuedAtError,<EOL>jwt.exceptions.InvalidAudienceError,<EOL>InvalidVerificationError,<EOL>InvalidCustomClaimError,<EOL>) as e:<EOL><INDENT>reason = [<EOL>x if x.endswith("<STR_LIT:.>") else "<STR_LIT>".format(x)<EOL>for x in list(e.args)<EOL>]<EOL>payload = None<EOL>status = <NUM_LIT><EOL>is_valid = False<EOL><DEDENT>except jwt.exceptions.DecodeError as e:<EOL><INDENT>self._reasons = e.args<EOL>reason = (<EOL>[<EOL>x if x.endswith("<STR_LIT:.>") else "<STR_LIT>".format(x)<EOL>for x in list(e.args)<EOL>]<EOL>if self.config.debug()<EOL>else "<STR_LIT>"<EOL>)<EOL>logger.debug(e.args)<EOL>is_valid = False<EOL>payload = None<EOL>status = <NUM_LIT> if self.config.debug() else <NUM_LIT><EOL><DEDENT><DEDENT>else:<EOL><INDENT>payload = None<EOL><DEDENT>if return_payload:<EOL><INDENT>return payload<EOL><DEDENT>status = <NUM_LIT:200> if is_valid else status<EOL>return is_valid, status, reason<EOL>
Verify that a request object is authenticated.