Salama bin Akwa reported,

Ali رضي الله عنه had stayed behind from the Prophet ﷺ at Khaybar because he was suffering from an eye ailment, and he said, "Am I to stay behind from the Messenger of Allah ﷺ?" So Ali set out and joined the Prophet ﷺ.On the evening of the night before the morning when Khaybar was conquered, the Messenger of Allah ﷺ said, "Tomorrow I will surely give the banner to a man," or he said, "Tomorrow the banner will be taken by a man whom Allah and His Messenger love," or he said, "who loves Allah and His Messenger. Allah will grant victory through him."Then suddenly Ali appeared, though we had not been expecting him.The people said, "Here is Ali."So the Messenger of Allah ﷺ gave him the banner, and Allah granted victory through him.

Bukhari 2975

Sahih

حدثنا قتيبة بن سعيد حدثنا حاتم بن إسماعيل عن يزيد بن أبي عبيد

عن سلمة بن الأكوع رضي الله عنه قال

كان علي رضي الله عنه تخلف عن النبي ﷺ في خيبر وكان به رمد فقال أنا أتخلف عن رسول الله ﷺ فخرج علي فلحق بالنبي ﷺ فلما كان مساء الليلة التي فتحها في صباحها فقال رسول الله ﷺ لأعطين الراية أو قال ليأخذن غدا رجل يحبه الله ورسوله أو قال يحب الله ورسوله يفتح الله عليه فإذا نحن بعلي وما نرجوه فقالوا هذا علي فأعطاه رسول الله ﷺ ففتح الله عليه

البخاري 2975صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Jihad and expeditions
Chapter
Banner of the Prophet ﷺ
Numbering
Darussalam 2975
Bukhari 2975