Working authentication and redirect to dashboard