

def validate_client_authorization(self):
    database = self.application.database
    client = database.find_client(self.client_id)
    if (not client):
        self.raise_http_401({
            'error': 'invalid_client',
            'error_description': 'Invalid client_id or code on Authorization header',
        })
    if (not database.client_has_authorization_code(self.client_id, client.code_from_header)):
        self.raise_http_401({
            'error': 'invalid_client',
            'error_description': 'Invalid client_id or code on Authorization header',
        })
    if (not database.client_has_authorization_code(self.client_id, self.code)):
        self.raise_http_400({
            'error': 'invalid_grant',
            'error_description': 'Invalid code for this client',
        })
    if (not database.client_has_redirect_uri_for_code(self.client_id, self.code, self.redirect_uri)):
        self.raise_http_400({
            'error': 'invalid_grant',
            'error_description': 'redirect_uri does not match',
        })
    if database.is_client_authorization_code_used(self.client_id, self.code):
        self.raise_http_400({
            'error': 'invalid_grant',
            'error_description': 'Authorization grant already used',
        })
    plugins.call('access-token-validation', self)

dataset/ETHPy150Open globocom/oauth2u/oauth2u/server/handlers/defaults.py AccessTokenHandler.validate_client_authorization/VarMisuse@68/106 `self`->`client`