Sayyiduna Mu'adh bin Jabal (may Allah be pleased with him) narrates: On a cloudy day during a journey, we prayed behind the Prophet (peace and blessings be upon him) facing a direction other than the qiblah. When the Prophet (peace and blessings be upon him) completed the prayer and gave the salam, the sun shone clearly. We said: "O Messenger of Allah! We have prayed facing a direction other than the qiblah." The Prophet (peace and blessings be upon him) said: "Your prayer has been raised to Allah Almighty with its due."
Al-Tabarani recorded it in al-Mu'jam al-Awsat; its chain contains Abu Ablah, the father of Ibrahim. Ibn Hibban mentioned him in the book al-Thiqat, and his name is Shimr bin Yaqzan.
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب الصلاة / 1981