Language:
كتاب الأحكام
93  
Judgments (Ahkaam)
(43)
Chapter: How do the people give the Bai'a to the Imam
(43)
باب كَيْفَ يُبَايِعُ الإِمَامُ النَّاسَ
Sahih al-Bukhari 7199, 7200

Narrated 'Ubada bin As-Samit:

We gave the oath of allegiance to Allah's Messenger (ﷺ) that we would listen to and obey him both at the time when we were active and at the time when we were tired and that we would not fight against the ruler or disobey him, and would stand firm for the truth or say the truth wherever we might be, and in the Way of Allah we would not be afraid of the blame of the blamers. (See Hadith No. 178 and 320)

حَدَّثَنَا إِسْمَاعِيلُ، حَدَّثَنِي مَالِكٌ، عَنْ يَحْيَى بْنِ سَعِيدٍ، قَالَ أَخْبَرَنِي عُبَادَةُ بْنُ الْوَلِيدِ، أَخْبَرَنِي أَبِي، عَنْ عُبَادَةَ بْنِ الصَّامِتِ، قَالَ "بَايَعْنَا رَسُولَ اللَّهِ صلى الله عليه وسلم عَلَى السَّمْعِ وَالطَّاعَةِ فِي الْمَنْشَطِ وَالْمَكْرَهِ‏.‏ ‏‏وَأَنْ لاَ نُنَازِعَ الأَمْرَ أَهْلَهُ، وَأَنْ نَقُومَ ـ أَوْ نَقُولَ ـ بِالْحَقِّ حَيْثُمَا كُنَّا لاَ نَخَافُ فِي اللَّهِ لَوْمَةَ لاَئِمٍ ‏"‏‏.‏
Reference : Sahih al-Bukhari 7199, 7200
In-book reference : Book 93, Hadith 60
USC-MSA web (English) reference : Vol. 9, Book 89, Hadith 307
  (deprecated numbering scheme)