The Messenger of Allah ﷺ was asked about accepting gifts from the ruler. He said, "Whatever Allah grants you of it without your asking for it or longing for it, take it and treat it as your own wealth."Hasan, may Allah have mercy on him, said, "There is no harm in accepting it, so long as you do not travel to seek it or set your heart upon it."
حدثنا أبو معاوية حدثنا هشام بن حسان القردوسي عن قيس بن سعد عن رجل حدثه
سئل رسول الله ﷺ عن إعطاء السلطان قال ما آتاك الله منه من غير مسألة ولا إشراف فخذه وتموله قال وقال الحسن رحمه الله لا بأس بها ما لم ترحل إليها أو تشرف لها
Its isnad is daif, due to the anonymity of the narrator from Abu Darda. The hadith previously occurred as sahih at 17860.