Some modifications to improve the external authentication script.