While the people were performing the morning prayer in the mosque of Quba, someone came to them and said, "The Messenger of Allah ﷺ has had Quran revealed to him during the night, and he has been commanded to face the Kaabah, so face it."They had been facing toward Sham, so they turned around and faced toward the Kaabah.
حدثنا يحيى بن سعيد عن سفيان حدثني عبد الله بن دينار سمعت
بينما الناس يصلون في مسجد قباء الغداة إذ جاء جاء فقال إن رسول الله ﷺ قد أنزل عليه الليلة قرآن وأمر أن تستقبل الكعبة فاستقبلوها واستداروا فتوجهوا نحو الكعبة
Its chain of transmission is sahih. Bukhari related it in 1:424 through Malik, from Abdullah bin Dinar. He also related it in 131 through Yahya, from Sufyan, like the chain given here, and through Sulayman and through Malik, from Abdullah bin Dinar. Muslim also related it, as in al-Muntaqa 828. It will come again through Malik in 5934. It is also found in Muwatta 1:201.