Updating authentication functions to prevent sending expired token.