register function
working authentication