Fix for issue #8152: Missing auth headers and a faulty JSON decode

Looks like this regressed in commit 9730157 due to fetch_url refactors.
Merge pull request #8187 from willangenent/devel

Fix for issue #8152: Missing auth headers and a faulty JSON decode