finished authentication logic