Imam Ali ibn Abi Talib, Alayhis Salam, reported:
The Prophet ﷺ, said,
“There is no obedience in regard to anyone or anything, if that obedience leads to disobedience of Allah.
Most certainly, obedience is only in regard to that which is good.”
عَنْ عَلِيٍّ رَضِيَ اللَّهُ عَنْهُ عَنْ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ قَالَ : لَا طَاعَةَ فِي مَعْصِيَةٍ إِنَّمَا الطَّاعَةُ فِي الْمَعْرُوفِ.
(This Hadith is Sahih/Authentic and agreed upon by the Hadith Masters – Muhaddithun)