Fault detection and exclusion (FDE) is significant for integrity monitoring of GNSS positioning for autonomous systems with navigation requirements. Moreover, the urban canyon scenario introduces additional challenges to the existing FDE for integrity monitoring, causing missed or false alarms, due to the significantly increased percentage of fault measurements. This paper proposed a sliding window aided FDE for GNSS positioning based on factor graph optimization (FGO) to alleviate these key issues. Different from the existing snapshot-based and the sequential-based (e.g. Extended Kalman filter) integrity monitoring methods where only the current or two consecutive epochs of measurements are considered in the FDE process, the proposed method in this paper improves the measurement redundancy with the help of the sliding window structure. Meanwhile, the GNSS measurements inside the sliding window are considered multiple times which enables the reconsideration of fault measurements. Moreover, the FGO employs multiple iterations and re-linearizations which improves the initial guess of the state estimation for FDE. The effectiveness of the proposed method is verified through a challenging dataset collected in urban canyons of Hong Kong using automobile-level low-cost GNSS receivers.