Improved function in the authServer