The proof of taking the Bay'at is abundantly found in the Aayat of the Holy Qur'aan,
and in the noble sayings of our beloved Prophet, Rasulullah Sallallahu Alayhi
Wasallam.
Two Aayat of the Holy Qur'aan are presented as examples:
Those who are swearing allegiance unto
thee (Muhammad) In reality they are swearing allegiance to Allah the Exalted,
because the object of this allegiance is to obey the Commandments of Allah
the Exalted, and when this is so, then the hand of Allah is above their hands.
Then (after allegiance) If anyone who would break his oath or covenant (that
will exhibit opposition instead of obedience) then the punishment of breaking
the covenant will fall on him, and he who fulfills the covenant which he
has made with Allah (in his "Oath of Allegiance")
then Allah will bestow on him an immense reward in near future. (Al-Qur'aan
48:10) O! Nabi Muhammad Sallallahu Alayhi Wasallam when the Muslim women
come to you (with the object) of taking the Bay'at (Oath of Allegiance) on
the following points that they will not join any partner with Allah the Exalted,
will not commit theft, nor commit adultery, nor kill their children, nor
will produce any illegitimate child forging falsely (that it is from the
sperm of their husband.) (In the age of ignorance, it was a custom of Arabian
women to rear up a child of someone else, and claimed that it was the child
from their own husband, or committed fornication and the illegitimate child
so born was ascribed to their own husband, which besides the major sin of
adultery, the sin of ascribing the child of someone else, to their husband
is also involved on which great warning of punishment has been foretold in
the sayings of Muhammad Sallallahu Alayhi Wasallam as related to in Abu Dawood
and Nisaai) and will not disobey you in Islamic Canonical Laws (which include
all religious commandments. Then If those women accept all these conditions
which form the basis of faith and acting upon them, perfects one's faith)
then accept their Bay'at and ask Allah to forgive (the previous sins.) Verily
Allah is Forgiving, Merciful. (Al-Qur'aan 60:12).

Al-Insaf fi bayan sabab al-ikhtilaf a rational explanation of difference of
opinion (in Fiqh)
Shah Waliullah Muhaddith Al-Dihlawi (rahi’mahullah)
In
the name of Allah the most gracious and merciful
Praise be to Allah who sent our master Muhammad (صلى الله عايه وسالم)
to mankind to guide them towards Allah with His permission and as a luminous
lamp. Then He inspired the Companions, the Followers and the diligent (mujtahidin)
jurists to preserve together the essence of their Prophet's (teachings) until
the world is called to an end. This is to complete His favour. He has the power
over every thing. I bear witness that there is no god but Allah alone and He
has no partner. I (also) bear witness that our master Muhammad is His servant
and Messenger after whom there is no Prophet (to come), may Allah bless him,
his progeny and the Companions altogether.
To proceed: says the one in need of the mercy of Allah the Kind-Wali Allah
b. 'Abd al-Rahim, may Allah al-Mighty complete His favours on both of them
here and in the world hereafter: "Once Allah al-Mighty inspired my heart
to a mizan (scale) which explained to me the cause of every disagreement that
happened among the followers (milla) of Muhammad (صلى الله عايه وسالم).
With (the help of) this (scale) I can recognise what is right in the sight
of Allah and in the sight of His Messenger. It (also) enabled me to explain
the cause of disagreements so plainly that there remains no doubt and ambiguity.