Planck developed his black body radiation theory assuming that atoms treated as simple harmonic oscillators can stay in states of very much defined energy. If normal frequency of such oscillator is $\nu$, then the energy levels are the multiples of $h \nu$ (that is $E_n = n h \nu$, forgetting about zero-point vibrations). From my understanding, here $h$ serves just a proportionality constant.
Later, Einstein stated that light can exist in quanta (photons). For each electromagnetic wave of frequency $\nu$ the minimal energy is again $h \nu$. He then very successfully explained the photoelectric effect with this approach. Here, again, $h$ is a proportionality constant.
My question is that why in these two cases $h$ is (or should be?) the same constant? What is the relation between these two $h$'s in two approaches. Why did this evolve this way? I mean from black body radiation experiments and later photoelectric effect measurements one can derive Planck constants, and see they are indeed the same (within some uncertainty). But this does not solve my problem of these $h$'s being assumed to be the same. I clearly miss some link between these ideas. Many thanks for those who can explain these in detail or point to relevant literature on the topic.