(121) باب مَا قِيلَ فِي لِوَاءِ النَّبِيِّ صلى الله عليه وسلم
Narrated Salama bin Al-Akwa:
Ali remained behind the Prophet (ﷺ) during the battle of Khaibar as he waysuffering from some eye trouble but then he said, "How should I stay behind Allah's Messenger (ﷺ)?" So, he set out till he joined the Prophet. Onthe eve of the day of the conquest of Khaibar, Allah's Messenger (ﷺ) said, "(No doubt) I will give the flag or, tomorrow, a man whom Allah and His Apostle love or who loves Allah and His apostle will take the flag. Allah will bestow victory upon him." Suddenly 'Ali joined us though we were not expecting him. The people said, "Here is 'Ali. "So,Allah's Messenger (ﷺ) gave the flag to him and Allah bestowed victory upon him.
Reference: Sahih al-Bukhari 2975
In-book reference: Book 56, Hadith 184
USC-MSA web (English) reference(deprecated numbering scheme): Vol. 4, Book 52, Hadith 219