On the day of Badr, I brought a sword and said, "Messenger of Allah, Allah has healed my heart against the polytheists," or something to that effect, "so grant me this sword."He replied, "This is neither mine nor yours."So I said to myself, "Perhaps it will be given to someone who has not endured what I have endured."Then the Messenger came to me and said, "You asked me for it when it was not mine to give, but now it has become mine, and it is yours."He said, then the verse was revealed, "They ask you about the spoils of war" [Anfal 8:1].
حدثنا أبو كريب حدثنا أبو بكر بن عياش عن عاصم بن بهدلة
لما كان يوم بدر جئت بسيف فقلت يا رسول الله إن الله قد شفى صدري من المشركين أو نحو هذا هب لي هذا السيف فقال هذا ليس لي ولا لك فقلت عسى أن يعطى هذا من لا يبلي بلائي فجاءني الرسول فقال إنك سألتني وليس لي وإنه قد صار لي وهو لك قال فنزلت {يسألونك عن الأنفال} الآية
This hadith is sahih. Abu Dawud narrated it, no. 2740, from the hadith of Abu Bakr bin Ayyash, and Muslim also narrated it.There is also a narration on this topic from Ubadah, recorded by Ahmad (5/323, no. 1748), from the hadith of Simak bin Harb, from Musab, 24, no. 23142.