def confirm_redirect_uri(self, client_id, code, redirect_uri, client,<EOL>*args, **kwargs):
client = client or self._clientgetter(client_id)<EOL>log.debug('<STR_LIT>',<EOL>client.client_id, code)<EOL>grant = self._grantgetter(client_id=client.client_id, code=code)<EOL>if not grant:<EOL><INDENT>log.debug('<STR_LIT>')<EOL>return False<EOL><DEDENT>if hasattr(grant, '<STR_LIT>'):<EOL><INDENT>return grant.validate_redirect_uri(redirect_uri)<EOL><DEDENT>log.debug('<STR_LIT>',<EOL>grant.redirect_uri, redirect_uri)<EOL>testing = '<STR_LIT>' in os.environ<EOL>if testing and redirect_uri is None:<EOL><INDENT>return True<EOL><DEDENT>return grant.redirect_uri == redirect_uri<EOL>
Ensure client is authorized to redirect to the redirect_uri.

        This method is used in the authorization code grant flow. It will
        compare redirect_uri and the one in grant token strictly, you can
        add a `validate_redirect_uri` function on grant for a customized
        validation.