Moved the generation of the cloud server client outside of the auth function.