It has been narrated on the authority of Abu Hurairah (RA) that the Holy prophet (ﷺ) said: Whoso obeys me obeys God, and whoso disobeys me disobeys God. Whoso obeys the commander (appointed by me) obeys me, and whoso disobeys the commander disobeys me.
Related hadith on this topic