They followed what the evil ones gave out (falsely) against the power of Solomon: the blasphemers were not Solomon but the evil ones teaching men magic, and such things as came down at Babylon to the angels Harut and Marut. But neither of these taught anyone (such things) without saying: "We are only for trial; So do not blaspheme." ~ Qur'an, 2:102When one looks up Harut and Marut online, Encyclopedia Britannica tells a very different story, essentially considering it mythology and not even adopting the mainline stance--that they brought mankind magick as a test of devotion, which was later imitated by other forms especially the kind of magick that was attributed to Solomon (as). Imagine if the notable Encyclopedia did something similar to traditions from the Bible! It would be unheard of. Yet, for some reason, this story must be passed on in a distorted way...
At any rate, how this was specifically connected to Solomon (as) is further explained by various scholars. In sum, Solomon was protecting mankind from the tribulations of magical texts, yet because they were in his possession and, as a prophet, he did notable things, the books were believed to have been the reason for his success.
That Sulayman use to follow up what was in the hands of the devils of magic, and he took it from them and put it all under his throne in his treasure house. The devils were not able to reach it, so they came to the men and said "Do you want the knowledge by which Sulayman used to subjugate the devils and the winds and other (things)?" They said, "Yes", and so the devils directed them to the treasure house, under the throne. So the men found it and then began acting upon it. This (false claim) continued until the people of Hijaz said that Sulayman used to also practice this, and that this is magic. Then Allaah, the Mighty and Majestic, revealed, upon the tongue of Muhammad (alayhis salaam) the exoneration of Sulayman from that. (related by Saeed bin Jubair)-------
That the devils wrote books on types of magic, after they knew of Sulayman's death, and so they wrote "Whoever wishes to attain such and such, let him do such and such", and they put all of this into a book, and then placed a seal on it upon the seal of Prophet Sulayman and they wrote as its title, "This is What Aasif bin Burkhyaa the Friend of the King Sulayman Wrote of the Kept Treasures of Knowledge". Then they buried it beneath his throne. Later, some of the Children of Israel found this book and they said, "By Allaah Sulayman's kingdom was not except by way of this (magic)". So they spread this magic amongst the people, they learned it and taught it, and magic is not found amongst anyone more than amongst the Jews... (related by Muhammad bin Ishaaq bin Yasaar)-------
The devils innovated a book in which there was magic and they spread it amongst the people teaching it to them. When Sulayman (alayhis salaam) heard of it, he followed up those books, took them and buried them under his throne, hating that the people would learn from them. When Allaah took Sulayman away, the devils took out those books from where they were and taught them to the people. They (the devils) said that this is the knowledge that Sulayman used to conceal and keep to himself. So Allaah excused Sulayman and exonerated him, saying, "Sulayman did not disbelieve, but the Shayaateen (devils) disbelieved, teaching men magic." (related by Qatadah)-------
The most detailed version:
"Whoever wants to arrive at such and such let him turn to the sun and let him say such and such. And whoever wants [to be able] to do such and such, let him face his back to the sun and let him say such and such." So they wrote the likes of this and put it in a book, and gave it the same title as mentioned by Ibn Ishaq above (Key of Solomon, Seal of Solomon etc). Then they buried it under Sulayman's throne. When Sulayman died, Iblees stood as a khateeb and said, "O people, verily Sulayman was not a prophet, but he was a magician, so hold to his magic which is in his place of retreat and in his houses", then he showed them the place in which it was buried, and when they found it they said, "By Allaah, Sulayman was a magician, and this is his magic, with it shall we worship, and through it shall we subdue (others)". However, the believers amongst those Jews said, "Rather, he was a Prophet, a believer". Then, when Allaah sent the Prophet Muhammad (alayhis salaam), he mentioned the Prophets, until he mentioned Dawud and Sulayman, so the Jews said, "Look at Muhammad, mixing truth with falsehood, he is mentioning Sulayman along with the Prophets, he was merely a magician who would carry the winds", so Allah revealed the verse, "Sulayman did not disbelieve, but the Shayaateen (devils) disbelieved, teaching men magic..." (related by Ibn Hawshab)More detailed information on the subject, with a line-by-line breakdown of the verse concerning Solomon (as) can be read here.
For more information on the magick attributed to Solomon (as) and its symbolic use by the Freemasons and Illuminati, this website seems to be a very good source, at least what was popularized by disinformation agent Dan Brown (there is so much there, I could only scan it). There are tons and tons of information out there analyzing the symbolism of Masonry, in particular the Temple imagery and all that. Here is a brief article on Masonic symbolism. And here is an article about the (alleged or at least, understood by the Masons) symbolism of Solomon's temple.