let doAuthentication return json for success
handle errors in the example