Sayyiduna Ubadah bin al-Samit (may Allah be pleased with him) narrates: Sayyiduna As'ad bin Zurarah (may Allah be pleased with him) said: "O people! Do you know on what you are giving the pledge of allegiance to Sayyiduna Muhammad (peace and blessings be upon him)? You are pledging to him that you will fight the Arabs and the non-Arabs, the jinn and mankind." Those people said: "Whomever he fights, we will fight; and with whomever he is at peace, we will be at peace." The people said: "O Messenger of Allah! Lay down a condition." The Prophet (peace and blessings be upon him) said: "Pledge to me that you will bear witness that there is no deity except Allah and that I am the Messenger of Allah, that you will establish the prayer and give zakah, that you will listen and obey, that you will not dispute with those entitled to authority in matters of government, and that you will protect me from everything from which you protect yourselves and your families." (Allamah al-Haythami says:) I say: Part of this narration is recorded in the Sahih.
Al-Tabarani recorded it in al-Mu'jam al-Awsat; its chain contains a narrator, Ali bin Zayd, who is da'if (weak), though he has also been declared trustworthy.