In line with the Qur'anQur'an 60:12 ↗يَٰٓأَيُّهَا ٱلنَّبِيُّ إِذَا جَآءَكَ ٱلۡمُؤۡمِنَٰتُ يُبَايِعۡنَكَ عَلَىٰٓ أَن لَّا يُشۡرِكۡنَ بِٱللَّهِ شَيۡـٔٗا وَلَا يَسۡرِقۡنَ وَلَا يَزۡنِينَ وَلَا يَقۡتُلۡنَ أَوۡلَٰدَهُنَّ وَلَا يَأۡتِينَ بِبُهۡتَٰنٖ يَفۡتَرِينَهُۥ بَيۡنَ أَيۡدِيهِنَّ وَأَرۡجُلِهِنَّ وَلَا يَعۡصِينَكَ فِي مَعۡرُوفٖ فَبَايِعۡهُنَّ وَٱسۡتَغۡفِرۡ لَهُنَّ ٱللَّهَۚ إِنَّ ٱللَّهَ غَفُورٞ رَّحِيمٞ
O prophet! If believing women come to you, pledging allegiance to you, on condition that they will not associate anything with God, nor steal, nor commit adultery, nor kill their children, nor commit perjury as to parenthood, nor disobey you in anything righteous, accept their allegiance and ask God’s forgiveness for them. God is Forgiving and Merciful.
The verse limits obedience to the messenger to what is right, matching no obedience in disobedience to God.
In line with the Qur'anQur'an 31:15 ↗وَإِن جَٰهَدَاكَ عَلَىٰٓ أَن تُشۡرِكَ بِي مَا لَيۡسَ لَكَ بِهِۦ عِلۡمٞ فَلَا تُطِعۡهُمَاۖ وَصَاحِبۡهُمَا فِي ٱلدُّنۡيَا مَعۡرُوفٗاۖ وَٱتَّبِعۡ سَبِيلَ مَنۡ أَنَابَ إِلَيَّۚ ثُمَّ إِلَيَّ مَرۡجِعُكُمۡ فَأُنَبِّئُكُم بِمَا كُنتُمۡ تَعۡمَلُونَ
But if they strive to have you associate with Me something of which you have no knowledge, do not obey them. But keep them company in this life, in kindness, and follow the path of him who turns to Me. Then to Me is your return; and I will inform you of what you used to do.
The verse forbids obeying even parents who push one to associate partners with God, matching no obedience in sin.