Sahih al-Bukhari 6823
صحيح البخاري#6823SahihNarrated Anas bin Malik:While I was with the Prophet (ﷺ) a man came and said, "O Allah's Messenger (ﷺ)! I have committed a legally punishable sin; please inflict the legal punishment on me'.' The Prophet (ﷺ) did not ask him what he had done. Then the time for the prayer became due and the man offered prayer along with the Prophet (ﷺ) , and when the Prophet (ﷺ) had finished his prayer, the man again got up and said, "O Allah's Messenger (ﷺ)! I have committed a legally punishable sin; please inflict the punishment on me according to Allah's Laws." The Prophet (ﷺ) said, "Haven't you prayed with us?' He said, "Yes." The Prophet (ﷺ) said, "Allah has forgiven your sin." or said, "....your legally punishable sin
Scholarly Authentication
We show the most cautious grade (weakest-wins) as the overall label. Individual scholars graded it as follows:
Every narration in Sahih al-Bukhari is accepted as Sahih (authentic) by the established status of the book.
In-book reference: 86:51