‘Abdullāh ibn ‘Umar (may Allah be pleased with him) reported that the Prophet (may Allah's peace and blessings be upon him) said: “Whoever swears by other than Allah has disbelieved or associated partners with Allah.”
شرح الحديث :
The Prophet (may Allah's peace and blessings be upon him) says something indicating that whoever swears by other Allah has taken such a thing a partner with Allah and has thus disbelieved in Allah. This is because swearing by something indicates glorification of that thing. Indeed, the only one worthy of glorification is Allah. So one should not swear except by Allah or by one of His attributes.