Sahih Muslim Book 20, Hadith Number 4592.

Chapter : It is good on the part of a leader to take the oath of allegiance from his forces when intending to fight, and an account of the allegiance of God’s pleasure under the tree.

It has been narrated on the authority of Abdullah b. Zaid who said: A person came to him and said: Here is Ibn Hanzala who is making people swear allegiance to him. He (,Abdullah) asked: To what effect? He replied: To the effect that they will die for him. ‘Abdullah said: I will never swear allegiance to this effect after the Messenger of Allah (may peace be upon him).