Imām ʿAbd al-Raḥmān ibn Nāṣir al-Saʿdī [d. 1376 AH] said:
It is incumbent upon the slave [of Allāh] to possess an intention that is all-encomapssing and comprehensive of all of his affairs. Such that he intends by it the Face of Allāh, and seeks closeness to Him, aspiring for His reward, expecting his bounty [in return for what he has put forward], and fearing His punishment. Then he should allow this intention to accompany him in every single one of his actions and sayings, and in all of his conditions. [With the express purpose] of fulfilling complete sincerity [towards Allāh], and defending himself from that which is contrary to it from showing off [through observed actions] or through spoken word [such as the recitation of the Qurʾān or relating of his good actions to people] seeking the praise of the creation, hoping for their adulation and glorification. Rather, if something of that nature should occur, let no slave [of Allāh] make that his goal, or the pinnacle of what he desires [from his actions].
Let the origin of his intention be sincerely for the Face of Allāh, seeking his reward without turning towards the creation, nor seeking any benefit from them or commemoration.
However, if something of that nature should occur without the slave [of Allāh] intending it, then such things are of no harm to him. Rather, they are from the express glad tidings for the believer [in this dunyā].
Source: Bahjah Qulūb al-Abrār: 16
Translated by: Riyāḍ al-Kanadī