صحيح مسلم Sahih Muslim كتاب الإمارة The Book on Government
باب الْبَيْعَةِ عَلَى السَّمْعِ وَالطَّاعَةِ فِيمَا اسْتَطَاعَ:

Chapter: Oath of allegiance pledging to hear and obey as much as possible

1 hadith
Hadith 1867
حَدَّثَنَا يَحْيَي بْنُ أَيُّوبَ ، وَقُتَيْبَةُ ، وَابْنُ حُجْرٍ ، وَاللَّفْظُ لِابْنِ أَيُّوبَ ، قَالُوا : حَدَّثَنَا إِسْمَاعِيلُ وَهُوَ ابْنُ جَعْفَرٍ ، أَخْبَرَنِي عَبْدُ اللَّهِ بْنُ دِينَارٍ ، أَنَّهُ سَمِعَ عَبْدَ اللَّهِ بْنَ عُمَرَ ، يَقُولُ : " كُنَّا نُبَايِعُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ عَلَى السَّمْعِ وَالطَّاعَةِ ، يَقُولُ : لَنَا فِيمَا اسْتَطَعْتَ " .
It has been narrated on the authority of'Abdullah bin 'Umar who said: We used to take oath to the Messenger of Allah (ﷺ) that we would listen to and obey his orders. He would tell us (to say in the oath): As far as it lies in my power.
Hadith Reference Sahih Muslim / The Book on Government / Hadith: 1867
Hadith Grading محدثین: أحاديث صحيح مسلم كلها صحيحة
Hadith Takhrij «أحاديث صحيح مسلم كلها صحيحة»