Ubada bin Walid reported,

We came to Jabir, meaning Ibn Abdullah, while he was in his mosque, and he said:The Messenger of Allah ﷺ came to us in this mosque of ours, and in his hand was a stick from a date-palm branch of the Ibn Tab variety. He looked and saw some phlegm on the qiblah wall of the mosque, so he went over to it and scraped it off with the stick. Then he said, "Which of you would like Allah to turn His face away from him?"Then he said, "When one of you stands to pray, Allah is before his face, so let him not spit in front of him, nor to his right. Let him spit to his left, under his left foot. But if it overcomes him suddenly, let him do like this with his garment," and he placed it over his mouth, then rubbed it together.Then he said, "Bring me some perfume." A young man from the neighborhood got up and ran off to his family, and came back with some khaluq perfume in his palm. The Messenger of Allah ﷺ took it and placed it on the tip of the stick, then dabbed it onto the spot where the phlegm had been.Jabir said, "From this practice you came to put khaluq perfume in your mosques."

Azami 3130

Sahih

عن عبادة بن الوليد بن عبادة بن الصامت قال

أتينا جابرا. يعني ابن عبد الله وهو في مسجده فقال: أتانا رسول الله ﷺ في مسجدنا هذا، وفي يده عرجون بن طاب فنظر فرأى في قبلة المسجد نخامة، فأقبل عليها فحتها بالعرجون ثم قال: أيكم يحب أن يعرض الله عنه بوجهه؟ ثم قال: إن أحدكم إذا قام يصلي فإن الله قبل وجهه، فلا ينصقن قبل جهه، ولا عن يمينه وليبصق عن يساره تحت رجله اليسرى، فإن عجلت به بادرة فليقل بثوبه هكذا ووضعه على فيه، ثم دلكه، ثم قال: أروني عبيرا فقام فتى من الحي يشتد إلى أهله فجاء بخلوق في راحته، فأخذه رسول الله ﷺ فجعله على رأس العرجون، ثم لطخ به على أثر النخامة. قال جابر: فمن هنا جعلتم الخلوق في مساجدكم.

الأعظمي 3130صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Mosques
Section
Prohibition of spitting in the masjid and towards the qibla
Numbering
Jami al-Kamil 3130 (2nd edition)
Azami 3130