On the authority of Jundab bin Najia (or Najia bin Jundab): On the day of the Battle of Taif, the Messenger of Allah (ص) had a secret talk with Ali (ع) and when the conversation turned long, Abu Bakr said to the Prophet: O Messenger of Allah, your dialogue and secrecy extended for long. The Prophet (ص) replied:
“I wasn’t speaking secrets to him, rather Allah was conversing secrets with him.”
Muttaqi Hindi, Kanz al-Ummal, V.13, page 139, narrated from Tabarani, Al-Mu’jam Al-Kabir, V.2, page 186. Ibn Maghazli in Al-Manaqib (page 124) has narrated from Jabir that in the battle of Taif, the Messenger of Allah (s.a.w.a.) talked to Ali in his ears and this conversation lasted a long time. On of those two men said, “Indeed, he had a lengthy secret conversation with his cousin.” When the Prophet (s.a.w.a.) heard about this matter, he said: “I didn’t relate a secret to him but it was Allah who told him a secret.”
And similar to this has been narrated from Anas. Aini, Manaqib Sayedna Ali, page 28. Also, refer to Tirmidhi, Jam'i as-Sahih, V.5, page 303; Ibn Asaker, Tarikh Madinah-Damishq, V.42, page 314.