Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
tirmidhi:2957Maḥmūd b. Ghaylān > Wakīʿ > Ashʿath al-Sammān > ʿĀṣim b. ʿUbaydullāh > ʿAbdullāh b. ʿĀmir b. Rabīʿah from his father

from his father who said: "We were with the Messenger of Allah ﷺ on a journey on a very dark night and we did not know where the Qiblah was. So each man among us prayed in his own direction. In the morning when we mentioned that to the Messenger of Allah ﷺ, then the following was revealed: "So wherever you turn, there is the Face of Allah. (2:115)"  

الترمذي:٢٩٥٧حَدَّثَنَا مَحْمُودُ بْنُ غَيْلاَنَ حَدَّثَنَا وَكِيعٌ حَدَّثَنَا أَشْعَثُ السَّمَّانُ عَنْ عَاصِمِ بْنِ عُبَيْدِ اللَّهِ عَنْ عَبْدِ اللَّهِ بْنِ عَامِرِ بْنِ رَبِيعَةَ عَنْ أَبِيهِ قَالَ

كُنَّا مَعَ النَّبِيِّ ﷺ فِي سَفَرِهِ فِي لَيْلَةٍ مُظْلِمَةٍ فَلَمْ نَدْرِ أَيْنَ الْقِبْلَةُ فَصَلَّى كُلُّ رَجُلٍ مِنَّا عَلَى حِيَالِهِ فَلَمَّا أَصْبَحْنَا ذَكَرْنَا ذَلِكَ لِلنَّبِيِّ ﷺ فَنَزَلَتْ (أَيْنَمَا تُوَلُّوا فَثَمَّ وَجْهُ اللَّهِ )  

قَالَ أَبُو عِيسَى هَذَا حَدِيثٌ غَرِيبٌ لاَ نَعْرِفُهُ إِلاَّ مِنْ حَدِيثِ أَشْعَثَ السَّمَّانِ أَبِي الرَّبِيعِ عَنْ عَاصِمِ بْنِ عُبَيْدِ اللَّهِ وَأَشْعَثُ يُضَعَّفُ فِي الْحَدِيثِ

See similar narrations below:

Collected by Tirmidhī, Ibn Mājah
tirmidhi:345Maḥmūd b. Ghaylān > Wakīʿ > Ashʿath b. Saʿīd al-Sammān > ʿĀṣim b. ʿUbaydullāh > ʿAbdullāh b. ʿĀmir b. Rabīʿah from his father

"We were with the Prophet on a journey on a very dark night and we did not know the direction of the Qiblah. So each man among us prayed in his own direction. In the morning when we mentioned that to the Prophet, then the following was revealed: So where ever you turn, there is the Face of Allah."  

الترمذي:٣٤٥حَدَّثَنَا مَحْمُودُ بْنُ غَيْلاَنَ حَدَّثَنَا وَكِيعٌ حَدَّثَنَا أَشْعَثُ بْنُ سَعِيدٍ السَّمَّانُ عَنْ عَاصِمِ بْنِ عُبَيْدِ اللَّهِ عَنْ عَبْدِ اللَّهِ بْنِ عَامِرِ بْنِ رَبِيعَةَ عَنْ أَبِيهِ قَالَ

كُنَّا مَعَ النَّبِيِّ ﷺ فِي سَفَرٍ فِي لَيْلَةٍ مُظْلِمَةٍ فَلَمْ نَدْرِ أَيْنَ الْقِبْلَةُ فَصَلَّى كُلُّ رَجُلٍ مِنَّا عَلَى حِيَالِهِ فَلَمَّا أَصْبَحْنَا ذَكَرْنَا ذَلِكَ لِلنَّبِيِّ ﷺ فَنَزَلَ (فَأَيْنَمَا تُولُّوا فَثَمَّ وَجْهُ الله)  

قَالَ أَبُو عِيسَى هَذَا حَدِيثٌ لَيْسَ إِسْنَادُهُ بِذَاكَ لاَ نَعْرِفُهُ إِلاَّ مِنْ حَدِيثِ أَشْعَثَ السَّمَّانِ وَأَشْعَثُ بْنُ سَعِيدٍ أَبُو الرَّبِيعِ السَّمَّانُ يُضَعَّفُ فِي الْحَدِيثِ وَقَدْ ذَهَبَ أَكْثَرُ أَهْلِ الْعِلْمِ إِلَى هَذَا قَالُوا إِذَا صَلَّى فِي الْغَيْمِ لِغَيْرِ الْقِبْلَةِ ثُمَّ اسْتَبَانَ لَهُ بَعْدَ مَا صَلَّى أَنَّهُ صَلَّى لِغَيْرِ الْقِبْلَةِ فَإِنَّ صَلاَتَهُ جَائِزَةٌ وَبِهِ يَقُولُ سُفْيَانُ الثَّوْرِيُّ وَابْنُ الْمُبَارَكِ وَأَحْمَدُ وَإِسْحَاقُ
ibnmajah:1020Yaḥyá b. Ḥakīm > Abū Dāwud > Ashʿath b. Saʿīd Abū al-Rabīʿ al-Sammān > ʿĀṣim b. ʿUbaydullāh > ʿAbdullāh b. ʿĀmir b. Rabīʿah from his father

“We were with the Messenger of Allah ﷺ on a journey, and the sky was overcast so it was difficult for us to determine the Qiblah. So we performed prayer, and we marked the location.* Later, when the sun reappeared, we realized that we had prayed facing a direction other than the Qiblah. We mentioned that to the Prophet ﷺ, then the Words were revealed: ‘So wherever you turn there is the Face of Allah.’” [2:115]  

ابن ماجة:١٠٢٠حَدَّثَنَا يَحْيَى بْنُ حَكِيمٍ حَدَّثَنَا أَبُو دَاوُدَ حَدَّثَنَا أَشْعَثُ بْنُ سَعِيدٍ أَبُو الرَّبِيعِ السَّمَّانُ عَنْ عَاصِمِ بْنِ عُبَيْدِ اللَّهِ عَنْ عَبْدِ اللَّهِ بْنِ عَامِرِ بْنِ رَبِيعَةَ عَنْ أَبِيهِ قَالَ

كُنَّا مَعَ رَسُولِ اللَّهِ ﷺ فِي سَفَرٍ فَتَغَيَّمَتِ السَّمَاءُ وَأَشْكَلَتْ عَلَيْنَا الْقِبْلَةُ فَصَلَّيْنَا وَأَعْلَمْنَا فَلَمَّا طَلَعَتِ الشَّمْسُ إِذَا نَحْنُ قَدْ صَلَّيْنَا لِغَيْرِ الْقِبْلَةِ فَذَكَرْنَا ذَلِكَ لِلنَّبِيِّ ﷺ فَأَنْزَلَ اللَّهُ {فَأَيْنَمَا تُوَلُّوا فَثَمَّ وَجْهُ اللَّهِ}