Hydrogen fuel cells (together with batteries) were used for electrical power in the Apollo program, where it was recombined with oxygen on board to produce electricity.
Doing chemistry in practical space environments means managing the following:
- macrogravity; large accelerations and vibrations during launch phase
- microgravity; weak, unpredictable accelerations in various directions, but no "up" or "down" during operational phase
- thermal excursions
- pressure excursions
So there must have been some serious testing efforts in early crewed spaceflight era, when there was the availability of plenty of oxygen and the only solar panels were tiny.
Question: When was the successful demonstration of a fuel cell in space? It would be great to have answers for both a Soviet and a US technology demonstration.