Move this into some sort of AuthenticatedRESTClient class so you don't have to redo it 1,000,000 times.