'Call Google API to exchange authorization code against token, with POST request, to
not be redirected.'

@api.model
def _get_google_token_json(self, authorize_code, service):

    Parameters = self.env['ir.config_parameter']
    base_url = Parameters.get_param('web.base.url', default='http://www.odoo.com?NoBaseUrl')
    client_id = Parameters.sudo().get_param(('google_%s_client_id' % (service,)), default=False)
    client_secret = Parameters.sudo().get_param(('google_%s_client_secret' % (service,)), default=False)
    headers = {'content-type': 'application/x-www-form-urlencoded'}
    data = werkzeug.url_encode({'code': authorize_code, 'client_id': client_id, 'client_secret': client_secret, 'grant_type': 'authorization_code', 'redirect_uri': (base_url + '/google_account/authentication')})
    try:
        (dummy, response, dummy) = self._do_request(GOOGLE_TOKEN_ENDPOINT, params=data, headers=headers, type='POST', preuri='')
        return response
    except urllib2.HTTPError:
        error_msg = _('Something    went    wrong    during    your    token    generation.    Maybe    your    Authorization    Code    is    invalid')
        raise self.env['res.config.settings'].get_config_warning(error_msg)
