Sunan an-Nasa'i 5022
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."
أَخْبَرَنَا وَاصِلُ بْنُ عَبْدِ الْأَعْلَى قَالَ حَدَّثَنَا وَكِيعٌ عَنْ الْأَعْمَشِ عَنْ عَدِيِّ بْنِ ثَابِتٍ عَنْ زِرِّ بْنِ حُبَيْشٍ عَنْ عَلِيٍّ قَالَ  عَهِدَ إِلَيَّ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ أَنْ لَا يُحِبُّنِي إِلَّا مُؤْمِنٌ وَلَا يَبْغُضُنِي إِلَّا مُنَافِقٌ