I have read that it is perhaps impossible for people who have never met the Prophet (ﷺ) to know it is truly him in a dream. So how did Shah Waliullah know for sure he saw the Prophet (ﷺ)?
It is possible for a person to see the Prophet (ﷺ) in a dream even if he never met the Prophet (ﷺ), since the Shaytaan cannot appear in the image of the Prophet (ﷺ). However one must also keep in mind that Shaytaan can appear in another form and claim that he is the Prophet (ﷺ).
Al-Haakim narrated via Aasim ibn Kulayb (who said), my father told me: I said to Ibn ‘Abbaas,
“I saw the Prophet (ﷺ) in a dream.” He said, “Describe him to me.” He said, “I mentioned al-Hasan ibn ‘Ali and said that he (ﷺ) looked like him.” He said, “You did indeed see him.”
So if one knows the physical characteristics of the Prophet (ﷺ), then perhaps one can make out whether one really saw the Prophet (ﷺ) or not.
 [Fath al-Baari, 12/383, 384]< Back to Questions