Fix authentication flow