Issue #18716 Refactor resources to use a separate function.
Issue #18716 Refactor auth to use a separate function.