[FIX] google_calendar: use the request root URL for the redirect_uri
Before this commit: if a different `web.base.url` is set with `web.base.url.freeze`, during the first synchronization of Google calendar it will show a mismatch URL error. The problem is that we send the `redirect_uri` based on the `web.base.url` in the `_get_authorize_uri` function. The solution is to use the request root URL instead. opw-3101741 closes odoo/odoo#113215 X-original-commit: 6d713e69e6f412c05fe2af81fb263e09713b4821 Signed-off-by: Arnaud Joset <arj@odoo.com> Signed-off-by: Pedram Bi Ria (pebr) <pebr@odoo.com>
This commit is contained in:
@@ -18,7 +18,8 @@ class GoogleCalendarController(http.Controller):
|
||||
this URL for authorization for example
|
||||
"""
|
||||
if model == 'calendar.event':
|
||||
GoogleCal = GoogleCalendarService(request.env['google.service'])
|
||||
base_url = request.httprequest.url_root.strip('/')
|
||||
GoogleCal = GoogleCalendarService(request.env['google.service'].with_context(base_url=base_url))
|
||||
|
||||
# Checking that admin have already configured Google API for google synchronization !
|
||||
client_id = request.env['google.service']._get_client_id('calendar')
|
||||
|
||||
@@ -112,10 +112,11 @@ class GoogleCalendarService():
|
||||
's': 'calendar',
|
||||
'f': from_url
|
||||
}
|
||||
base_url = self.google_service._context.get('base_url') or self.google_service.get_base_url()
|
||||
return self.google_service._get_authorize_uri(
|
||||
'calendar',
|
||||
self._get_calendar_scope(),
|
||||
self.google_service.get_base_url() + '/google_account/authentication',
|
||||
base_url + '/google_account/authentication',
|
||||
state=json.dumps(state),
|
||||
approval_prompt='force',
|
||||
access_type='offline'
|
||||
|
||||
Reference in New Issue
Block a user