Fix 500 error on authenticate() when 'next' is not provided