When the Prophet ﷺ entered the House, he supplicated in all its corners but did not pray inside it. When he came out, he prayed two units of prayer facing the Kaabah and said, "This is the qiblah."
حدثنا عبد الرزاق أنا ابن جريج قال قلت لعطاء أسمعت ابن عباس فذكر قصة ولكني سمعته يقول أخبرني
أن النبي ﷺ لما دخل البيت دعا في نواحيه كلها ولم يصل فيه حتى خرج فلما خرج ركع ركعتين في قبل الكعبة وقال هذه القبلة
Its isnad is sahih. It is found in Bukhari, Shab edition, in the Book of Prayer, on the saying of Allah Almighty, "And take from the standing place of Ibrahim a place of prayer" [Baqarah 2:125], and in Muslim 2/968 no. 1330, and in Abdul-Razzaq 5/78 no. 9056, and it has already been mentioned with similar wording. It will also come up again, Allah willing, in the Musnad of Bilal bin Rabah.