Sunan an-Nasa'i, Book 47, Hadith 34 (In-Book) ⓘ
It was narrated that Zirr said: 'Ali said: "The Unlettered Prophet [SAW] made a covenant with me, that none but a believer would love me, and none but a hypocrite would hate me."
أَخْبَرَنَا يُوسُفُ بْنُ عِيسَى قَالَ أَنْبَأَنَا الْفَضْلُ بْنُ مُوسَى قَالَ أَنْبَأَنَا الْأَعْمَشُ عَنْ عَدِيٍّ عَنْ زِرٍّ قَالَ قَالَ عَلِيٌّ إِنَّهُ لَعَهْدُ النَّبِيِّ الْأُمِّيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ إِلَيَّ أَنَّهُ لَا يُحِبُّكَ إِلَّا مُؤْمِنٌ وَلَا يَبْغُضُكَ إِلَّا مُنَافِقٌ
also referenced under: Hadith 5018 (Reference) & Volume 6, Book 47, Hadith 5021 (DarusSalam)