Sunan an-Nasa'i, Volume 6, Book 47, Hadith 5025 (DarusSalam)

It was narrated that 'Ali said: "The Prophet [SAW] made a covenant with me that none would love me but a believer, and none would hate me but a hypocrite."

أَخْبَرَنَا وَاصِلُ بْنُ عَبْدِ الْأَعْلَى قَالَ حَدَّثَنَا وَكِيعٌ عَنْ الْأَعْمَشِ عَنْ عَدِيِّ بْنِ ثَابِتٍ عَنْ زِرِّ بْنِ حُبَيْشٍ عَنْ عَلِيٍّ قَالَ عَهِدَ إِلَيَّ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ أَنْ لَا يُحِبُّنِي إِلَّا مُؤْمِنٌ وَلَا يَبْغُضُنِي إِلَّا مُنَافِقٌ

sunnah.com