(Abridged) The terrestrial planets, comets, and meteorites are significantly enriched in 15N compared to the Sun and Jupiter. While the solar and jovian nitrogen isotope ratio is believed to represent the composition of the protosolar nebula, a still unidentified process has caused 15N-enrichment in the solids. Several mechanisms have been proposed to explain the variations, including chemical fractionation. However, observational results that constrain the fractionation models are scarce. While there is evidence of 15N-enrichment in prestellar cores, it is unclear how the signature evolves into the protostellar phases. Our aim is to measure the 14N/15N ratio around three nearby, embedded low-to-intermediate-mass protostars. Isotopologues of HCN and HNC were used to probe the 14N/15N ratio. A selection of H13CN, HC15N, HN13C, and H15NC transitions was observed with the APEX telescope. The 14N/15N ratios were derived from the integrated intensities assuming a standard 12C/13C ratio. The assumption of optically thin emission was verified using radiative transfer modeling and hyperfine structure fitting. Two sources, IRAS 16293A and R CrA IRS7B, show 15N-enrichment by a factor of around 1.5-2.5 in both HCN and HNC with respect to the solar composition. Solar composition cannot be excluded for the third source, OMC-3 MMS6. Furthermore, there are indications of a trend toward increasing 14N/15N ratios with increasing outer envelope temperature. The enhanced 15N abundances in HCN and HNC found in two Class~0 sources (14N/15N of 160-290) and the tentative trend toward a temperature-dependent 14N/15N ratio are consistent with the chemical fractionation scenario, but 14N/15N ratios from additional tracers are indispensable for testing the models. Spatially resolved observations are needed to distinguish between chemical fractionation and isotope-selective photochemistry.