The Prophet ﷺ heard a man swearing by his father, so he said, "Do not swear by your fathers. Whoever swears by Allah must speak the truth, and whoever has an oath sworn to him by Allah must accept it. Whoever does not accept what is sworn by Allah has no connection with Allah."
حدثنا محمد بن إسمعيل بن سمرة حدثنا أسباط بن محمد عن محمد بن عجلان عن نافع
سمع النبي ﷺ رجلا يحلف بأبيه فقال لا تحلفوا بآبائكم من حلف بالله فليصدق ومن حلف له بالله فليرض ومن لم يرض بالله فليس من الله
Its chain of transmission is daif. Bayhaqi (10/181) narrated it from the hadith of Asbat with this wording, and Busiri graded it sahih. See hadith no. 1967 for its defect. I say, the hadith "Do not swear by your fathers" is sahih and agreed upon (by Bukhari and Muslim), narrated from the hadith of Abdullah bin Dinar from Ibn Umar with this wording.