Sahih Muslim 1861
Sahih Muslim · Book 33: The Book on Government · It is recommended for the army to swear allegiance to the ruler when intending to fight, and an account of Bay'at Ar-Ridwan beneath 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 (ﷺ).