Ali bin Abu Talib reported,

The Prophet ﷺ dispatched a military expedition and placed a man from the Ansar in command, ordering the men to listen to him and obey him.They angered him over some matter, so he said, "Gather firewood for me."They gathered firewood.Then he said, "Light a fire."They lit a fire for him.He then asked, "Did the Messenger of Allah ﷺ not order you to listen to me and obey me?"They replied, "Yes."He said, "Then enter it."They began looking at one another and said, "We only fled to the Messenger of Allah ﷺ to escape the fire."They remained in this state until his anger subsided and the fire went out.When they returned to the Prophet ﷺ, they mentioned what had happened. He said, "Had they entered it, they would never have come out of it. Obedience is only in what is right."

Ahmad 1018

Sahih

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

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

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

أحمد 1018صحيح
Contents
Reference
Commentary
Ayat
Collection
Musnad Ahmad
Book
Ali bin Abu Talib
Numbering
Darussalam 1018
Ahmad 1018