The Messenger of Allah ﷺ said, "Whoever obeys me has obeyed Allah, and whoever disobeys me has disobeyed Allah. Whoever obeys my appointed leader has obeyed me, and whoever disobeys my appointed leader has disobeyed me."
حدثنا عبد الرزاق حدثنا معمر أخبرني الزهري عن أبي سلمة
قال رسول الله ﷺ من أطاعني فقد أطاع الله ومن عصاني فقد عصى الله ومن أطاع أميري فقد أطاعني ومن عصى أميري فقد عصاني
Its isnad is sahih. It is a longer version of 7330, and a repeat of 7428. Bukhari related it, 13:99, and Muslim, 2:85, both of them by way of Yunus from Zuhri, with this isnad and wording.