If you start with y=Aexp^{(ikx)}+Bexp^{(-ikx)}, you can expand the exponential forms in terms of sins and cosines and then rearrange to get y(x)=C cos(kx)+D sin(kx), with C = i*(A-B) and D = (A+B). You can then go through and solve for C in the usual way and find that it equals ± SQRT(2/L). Most texts kind of gloss over what happens to A and B because they don't have any physical meaning by themselves. But if you're determined, you can instead AVOID the simplification of using C/D and use the more complicated expressions to solve for A and B, but the end results will be the same, because the normalization coefficient isn't A or B alone, but a linear combination of them. If you try it, you'll see that A and B are both themselves imaginary, which will give you real numbers for C and D - and, thus, the wavefunction itself.

You haven't written out your entire derivation so I can't pinpoint what you're doing wrong.