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.
nasai:4150ʿĪsá b. Ḥammād > al-Layth > Yaḥyá b. Saʿīd > ʿUbādah b. al-Walīd b. ʿUbādah b. al-Ṣāmit from his father > ʿUbādah b. al-Ṣāmit

"We pledged to the Messenger of Allah to hear and obey, both in times of hardship and ease." And he mentioned similarly.  

النسائي:٤١٥٠أَخْبَرَنَا عِيسَى بْنُ حَمَّادٍ قَالَ أَنْبَأَنَا اللَّيْثُ عَنْ يَحْيَى بْنِ سَعِيدٍ عَنْ عُبَادَةَ بْنِ الْوَلِيدِ بْنِ عُبَادَةَ بْنِ الصَّامِتِ عَنْ أَبِيهِ أَنَّ عُبَادَةَ بْنَ الصَّامِتِ قَالَ

بَايَعْنَا رَسُولَ اللَّهِ ﷺ عَلَى السَّمْعِ وَالطَّاعَةِ فِي الْعُسْرِ وَالْيُسْرِ وَذَكَرَ مِثْلَهُ