'Call Google API to refresh the token, with the given authorization code
:param service : the name of the google service to actualize
:param authorization_code : the code to exchange against the new refresh token
:returns the new refresh token'

@api.model
def generate_refresh_token(self, service, authorization_code):

    Parameters = self.env['ir.config_parameter'].sudo()
    client_id = Parameters.get_param(('google_%s_client_id' % service))
    client_secret = Parameters.get_param(('google_%s_client_secret' % service))
    redirect_uri = Parameters.get_param('google_redirect_uri')
    headers = {'Content-type': 'application/x-www-form-urlencoded'}
    data = werkzeug.url_encode({'code': authorization_code, 'client_id': client_id, 'client_secret': client_secret, 'redirect_uri': redirect_uri, 'grant_type': 'authorization_code'})
    try:
        req = urllib2.Request(GOOGLE_TOKEN_ENDPOINT, data, headers)
        content = urllib2.urlopen(req, timeout=TIMEOUT).read()
    except urllib2.HTTPError:
        error_msg = _('Something    went    wrong    during    your    token    generation.    Maybe    your    Authorization    Code    is    invalid    or    already    expired')
        raise self.env['res.config.settings'].get_config_warning(error_msg)
    content = json.loads(content)
    return content.get('refresh_token')
