Sayyiduna Jarir (may Allah be pleased with him) said: I came to the Messenger of Allah (peace and blessings be upon him) and said: "O Messenger of Allah! I pledge allegiance to you on emigration (hijrah)." So the Messenger of Allah (peace and blessings be upon him) took my pledge, and he stipulated for me sincere goodwill towards every Muslim, so I pledged allegiance to him (peace and blessings be upon him) on that.
Hadith Referenceالمعجم الكبير للطبراني / باب الجيم / 2451