It is narrated from Sayyiduna Ibn Umar (may Allah be pleased with them both) that the Prophet (peace and blessings be upon him) used to take the pledge of allegiance on the condition of listening and obeying, then he would say: "As much as you are able," (that is, as far as possible you will listen and obey).
Hadith Referenceمسند احمد / مسند المكثرين من الصحابة / 5282
Hadith Gradingحکم دارالسلام:إسناده صحيح ، خ : 7202 ، م : 1867 .