If the FA's know the code....then they can be convinced to give it up...thus the door is not secure. If the FA's have a key to the door....it can be taken away and again....the door is not secure.
The only way to secure the door is to have it designed so only the cockpit crew can open the door from the cockpit side.
The goal is to keep Hijackers from entering the cockpit.....thus all other concerns are not relevant. Or...am I missing something!