def from_json(json_data):
        """
            Returns a pyalveo.OAuth2 given a json string built from the oauth.to_json() method.
        """
        #If we have a string, then decode it, otherwise assume it's already decoded
        if isinstance(json_data, str):
            data = json.loads(json_data)
        else:
            data = json_data
        oauth = Cache(cache_dir=data.get('cache_dir',None), max_age=data.get('max_age',None))
        return oauth
Returns a pyalveo.OAuth2 given a json string built from the oauth.to_json() method.