Sayyiduna Ibn Abbas (may Allah be pleased with him) narrated that the Messenger of Allah (peace and blessings be upon him) was sitting in the shade of a room, and the shade was about to shrink, when the Messenger of Allah (peace and blessings be upon him) said: "A man will soon come to you who will look at you with the eyes of a devil; when he comes to you, do not speak to him." Not much time had passed when a man appeared. He (peace and blessings be upon him) called him and said: "On what basis do you and your companions abuse me?" He said: "Call them." So he (peace and blessings be upon him) called them, and they began swearing by Allah that they had neither said it nor done it, until he (peace and blessings be upon him) pardoned them. So Allah, the Mighty and Majestic, revealed this verse: "On the Day when Allah will resurrect them all, they will swear to Him as they swear to you" [Surah al-Mujadilah: 18] to the end of the verse.
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 12255