It is narrated from Sayyiduna Ubadah bin Samit (may Allah be pleased with him): We pledged allegiance to the Messenger of Allah (peace and blessings be upon him) to listen and obey, whether in hardship or ease, whether we liked it or disliked it, and that we would not dispute with the rulers regarding authority (unless we saw open disbelief from them), and that we would always support the truth, not fearing the blame of any critic for the sake of Allah.
Hadith Referenceالسنن المأثورة / باب الجهاد / 625
Hadith Takhrijصحیح بخاری، الاحکام، باب کیف یبایع الامام الناس، رقم: 7199، صحیح مسلم، الامارہ، باب وجوب طاعہ الامراء فی غیر معصیہ، رقم: 1709۔