Sinan bin Abdullah al-Ansari (may Allah have mercy on him) narrated: I asked Sayyiduna Anas bin Malik (may Allah be pleased with him) about locusts, and he said: "We went out with the Messenger of Allah (peace and blessings be upon him) towards Hunayn, and Sayyiduna Umar bin al-Khattab (may Allah be pleased with him) had a basket containing locusts which he had tied behind him (on his mount). He would take locusts out of it and give them to us, and we would eat them, while the Messenger of Allah (peace and blessings be upon him) was watching."
Sayyiduna Anas (may Allah be pleased with him) said: "Then when we returned to Madinah, locusts used to be brought to us; we would buy them and obtain them in large quantities, then dry them (spread out) on the roofs, and then we kept eating them for a long time."
Related hadith on this topic