It is commonplace that it is about 6000 Kelvin.
But who came to this value first?
And with what method? Based on the black body radiation theory?
History of Science and Mathematics Stack Exchange is a question and answer site for people interested in the history and origins of science and mathematics. It only takes a minute to sign up.Sign up to join this community
As is often the case, nobody was first, but both early and modern estimates of the surface temperature are based on comparisons to the black body radiation, the modern value is about 5800 K. The solar corona is however much hotter, several million K. That was discovered by Grotrian (1939) and independently Edlen, who noticed that the observed spectral lines are emitted by iron, calcium, and nickel in very high stages of ionization. Why it is so hot is still an open problem, one promising hypothesis is the so-called "magnetic carpet".
For the surface temperature the older method used measurements of the solar constant, the mean energy flux per unit area at Earth's distance, and the inverse square law, to estimate the mean energy flux per unit area at the Sun's surface. First solar constant measurements were made by Pouillet in France and Herschel at the Cape of Good Hope in 1837. Subsequent measurements by Violle on Mont Blanc (1875) and Langley on Mount Whitney in California (1884) turned out to be further from modern values. See Concise History of Solar and Stellar Physics by Tassoul and Tassoul (p. 41).
But to get the temperature one needed to relate it to Sun's luminosity (total emitted energy). The modern law, which says that the luminosity is proportional to the fourth power of surface temperature, was only formulated by Stefan in 1879, and Boltzmann derived it from thermodynamics in 1884. Before that the two were related semi-empirically using laboratory experiments, with estimates based on Newton's and Dulong-Petit's cooling laws giving, respectively, overestimates and underestimates. In 1884, when the Stefan's law was still not accepted, Langley wrote in New Astronomy that "it is probable from all experiments made to date, that the solar effective temperature is not less than 3000 nor more than 30000 degrees of the centigrade thermometer". Later estimates were based on matching empirical peak intensity to Wien's (1896) or Planck's (1900) black body radiation curves, and analyzing the line spectrum of solar radiation. A consensus close to the modern value emerged by the end of 19th century, but only later advances in radiation theory firmed it up. See Astrophysics and Twentieth-Century Astronomy to 1950 (pp. 66-67).
More details on modern measurements can be found at Luminosity and Temperature of the Sun workshop website.