We pledged allegiance to the Messenger of Allah ﷺ to hear and obey, and he said, "To the best of your ability."
حدثنا وكيع حدثنا شعبة عن عتاب مولى ابن هرمز قال سمعت
بايعنا رسول الله ﷺ على السمع والطاعة فقال فيما استطعتم
Its isnad is hasan. Attab, the freedman of Ibn Hurmuz, is truthful (sadooq), and the rest of the narrators are leading authorities. In the printed edition, "Ghiyath" appears in place of "Attab," which is a scribal error, and the correct form is as we have established it, following Ibn Majah.The hadith was narrated by Bukhari, 13/193, no. 7202, in Fath al-Bari, in the Book of Rulings, chapter on how people should give allegiance to the leader, by Muslim, 1/75, no. 55, in the Book of Faith, chapter on giving allegiance based on hearing and obeying, by Nasai, 7/152, no. 4189, from Jareer, and by Ibn Majah, 2/958, no. 2868, with the same wording and chain.