Further commentary on D&C 129. All of this is a quotation, reference at the end.
Among the vast number of the Keys of the Kingdom of God Joseph presented the following one to the Twelve for there benefit in there experience & travels in the flesh which is as follows. In order to detect the devel when he transforms himself nigh unto an angel of light. When an angel of God appears unto man face to face in personage & reaches out his hand unto the man & he takes hold of the angels hand & feels a substance the Same as one man would in shaking hands with another he may then know that it is an angel of God, & he should place all Confidence in him Such personages or angels are Saints with there resurrected Bodies, but if a personage appears unto man & offers him his hand & the man takes hold of it & he feels nothing or does not sens any substance he may know it is the devel, for when a Saint whose body is not resurrected appears unto man in the flesh he will not offer him his hand for this is against the law given him & in keeping in mind these things we may detec the devil that he decieved us not. (Wilford Woodruff Diary, 27 June 1839)
The morning after the visitations from the angel Moroni (21-22 September 1823), Joseph Smith went to the side of the hill Cumorah to unearth the plates he had seen in his vision. As he later told Oliver Cowdery, on the road to Cumorah he became fixed and determined to obtain the plates for wealth and prestige and not for the glory of God. Only after attempting unsuccessfully three times to remove the plates from the stone box in which they were enclosed did he become aware that Moroni was present. The angel indicated that he was permitted by God to be led by this evil spirit so that from that time forth he would always know the difference between a true spirit and an evil spirit. This was only a beginning of his instructions in the gift of discerning spirits (D&C 46:15-16, 23, 27). Subsequent revelations through Joseph Smith gave greater detail concerning keys to detecting the adversary. D&C 50:30-35 gave instructions that if after prayer a spirit would not manifest itself, the individuals involved would have power to rebuke the spirit. Joseph Smith had experience himself with this type of manifestation. On the banks of the Susquehanna River, Michael appeared to intervene and detect the devil when he appeared as an angel of light (D&C 128:20), indicating another dimension to this question of detection. Because the adversary apparently can take light and truth away from the disobedient (D&C 93:39), he can attempt to pass as an angel of glory (2 Corinthians 11:14; D&C 129:8; Moses 1:2, 9, 11-25). As indicated in this discourse, Joseph Smith therefore revealed additional keys of detection. Far from saying that when the instructions of this discourse were followed, the adversary’s only recourse was to attempt to return the handshake, in a December 1840 discourse Joseph says, “The Devil…will either shrink back…or offer his hand.” He will not remain absolutely still if he is tested. On 28 April 1842, the Prophet revealed to the Relief Society, and on 1 May 1842 to the Nauvoo populace, that there was another dimension for determining whether manifestations and revelations were approved by God. There were “keys of the kingdom,” he said to a Sunday audience of the saints in the Grove, “certain signs and words by which false spirits and personages may be detected from true, which cannot be revealed to the Elders till the Temple is completed…. There are signs…the Elders must know…to be endowed with the power, to finish their work and prevent imposition” (1 May 1842 discourse). Three days later Joseph Smith revealed these sacred keys to nine men—in accordance with his plans as announced to the Relief Society just six days before (28 April 1842). To these men he taught the keys of prayer and detection whereby all false documents, revelations, or manifestations could be tested (Times and Seasons 5 [15 September 1844]:649-50 and Letter of Orson Hyde, George A. Smith, and Ezra T. Benson to Brigham Young, dated 5 April 1849, Brigham Young Collection, Church Archives). They were so sacred that when Heber C. Kimball wrote to fellow apostle Parley P. Pratt just a few weeks later, he said that Joseph had taught them some precious things on the priesthood that would cause his soul to rejoice if he knew them, but that Joseph had given instructions that these keys not be written about. Heber concluded his description of the newly revealed endowment by saying that Parley would have to come to Nauvoo to receive the instruction for himself (Letter of Heber C. Kimball to Parley P. Pratt, 17 June 1842, Church Archives). Parley arrived in Nauvoo on 7 February 1843, and although the Prophet made him wait ten months before giving him his endowment (2 December 1843), after only two days he partially satisfied Parley’s curiosity by giving him the instructions contained in D&C 129—the same instructions as given in this discourse, 27 June 1839 (see also Joseph Smith Diary, 9 February 1843, Church Archives). George A. Smith, who received his endowment with Parley P. Pratt in December 1843, and who also was a witness to all the dimensions of Joseph’s teachings on this subject, later said, “There was no point upon which the Prophet Joseph dwelt more than the discerning of Spirits” (“Minutes of Meetings held in Provo City,” 28 November 1869, Church Archives). This may be true because the Prophet insisted that true religion was one of individual participation in revelation from God but that in their zeal many could be deceived.
From Ehat, Andrew F., Lyndon W. Cook, Truman G. Madsen, and Joseph Smith. The Words of Joseph Smith : The Contemporary Accounts of the Nauvoo Discourses of the Prophet Joseph. Provo, Utah (Salt Lake City, Utah: Religious Studies Center BYU, 1980): 21.
I am indebted to Mark Simmons for reminding me of this reference.