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

Looks like this regressed in commit 9730157 due to fetch_url refactors.