Ali bin Abu Talib reported,

The Prophet ﷺ sent out a military expedition and placed a man from the Ansar in command, ordering them to obey him. At one point the commander became angry and said, "Did the Prophet ﷺ not command you to obey me?"They replied, "Yes, indeed."He said, "Then gather firewood for me." So they gathered it.Then he said, "Light a fire." So they lit it.Then he said, "Enter it."They were about to do so, but some of them began holding others back, saying, "We fled to the Prophet ﷺ to escape the Fire." They kept refusing until the fire died down, and his anger subsided.When this reached the Prophet ﷺ, he said, "Had they entered it, they would never have come out of it until the Day of Resurrection. Obedience is only in what is right."

Bukhari 4340

Sahih

حدثنا مسدد حدثنا عبد الواحد حدثنا الأعمش قال حدثني سعد بن عبيدة عن أبي عبد الرحمن

عن علي رضي الله عنه قال

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

البخاري 4340صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Expeditions
Chapter
Expedition of Abdullah bin Huzafa Sahmi and Alqama bin Mujazziz Mudliji
Numbering
Darussalam 4340
Bukhari 4340