NPE during authentication #2569

For Issue #2569