Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) narrates: On the night of the meeting with the jinn, the Prophet (peace and blessings be upon him) asked me to come along with him, so I set out with the Prophet (peace and blessings be upon him) until we reached the upper part of Makkah. The Prophet (peace and blessings be upon him) drew a line for me and said: "Stay right here." Then he went towards the jinn. I saw some figures coming down from the tops of the mountains towards him, until they came between me and the Prophet (peace and blessings be upon him). I drew my sword and thought that I would certainly strike with it and save the Prophet (peace and blessings be upon him). Then I remembered the saying of the Prophet (peace and blessings be upon him) that I was to stay right here until he came to me. The narrator says: The situation continued like this until, when true dawn began to break, the Prophet (peace and blessings be upon him) came. I was standing at that time. He said: "Have you remained in this state all along?" I said: "Even if a month had passed, I would have remained like this until you came to me." Then I told him what I had intended to do. The Prophet (peace and blessings be upon him) said: "If you had gone out of it, you and I would not have met until the Day of Resurrection." Then the Prophet (peace and blessings be upon him) interlaced his fingers with my fingers and then said: "I was promised that humans and jinn would believe in me. As for humans, they are believing in me, and as for the jinn, you have seen." The narrator says: The Prophet (peace and blessings be upon him) said: "I think that my time has drawn near." I said: "O Messenger of Allah! Will you not appoint Sayyiduna Abu Bakr (may Allah be pleased with him) as successor?" The Prophet (peace and blessings be upon him) turned his face away from me, and I felt that perhaps this was not suitable. I said: "O Messenger of Allah! Will you not appoint Sayyiduna Umar (may Allah be pleased with him) as successor?" The Prophet (peace and blessings be upon him) turned his face away from me, and I realised that this too was not suitable in his view. I said: "O Messenger of Allah! Will you not appoint Sayyiduna Ali (may Allah be pleased with him) as successor?" The Prophet (peace and blessings be upon him) said: "By the One besides whom there is no god, he is such a person that if you pledge allegiance to him and obey him, he will cause all of you to enter Paradise."
Al-Tabarani recorded it; its chain contains a narrator, Yahya bin Ya'la al-Aslami, and he is da'if (weak).