Google Settings Error: redirect_uri_mismatch

Hey guys,
So I have followed the erpnext documentation on setting up Google Settings for Google Calendar and Google Drive

However, upon authorisation of access the error 400 appears Error: redirect_uri_mismatch

The redirect URI set in google cloud platform is this: http://URL RETRACTED?cmd=frappe.integrations.doctype.google_drive.google_drive.google_callback

The redirect URI appearing in the on the error page however, is very very different: http://URL RETRACTED:8001?cmd=frappe.integrations.doctype.google_drive.google_drive.google_callback, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com/apis/credentials/oauthclient/587641976614-tvk20sobndofsk3o39bmpkoqvheci032.apps.googleusercontent.com?project=587641976614

I have retracted the erpnext URL for privacy reasons but please observe the added port :8001 to the URL

This seems to be connected to the concept where any links added in erpnext emails do not workā€¦ same port is added automatically although we are not accessing erpnext on that port.

Hello ERPNext Team

Hope you are all well!

Having the same problem here too redirects to

  • internal port 8000

when google would be accessing

  • external port 443 or 80

Any fixes for this?

Kind regards Ryder

i have the same problem . my erpnext website port is 70 . google drive is directing me to the router page which port is 80 . if i change the redirect website to port 70 in google drive api, it gives me an error :point_down:

ā€œThe redirect URI set in google cloud platform is this: http://URL RETRACTED?cmd=frappe.integrations.doctype.google_drive.google_drive.google_callbackā€

Iā€™m noticing this too. Iā€™m not using the built-in Traefik router, but HAProxy at my network edge to proxy connections from web on 443 to ERPNext on 80. The response URLs are being sent to O365 as http:///api/* instead of https:///api*. Itā€™s not immediately obvious to me how to change this configuration. Is there a config for this somewhere, or do I need to somehow rewrite these?

set ā€œhost_nameā€ key as the base url of site in site_config.json

5 Likes

Thank you for pointing me at that! That fixed the issue I was having ! :blush:

Iā€™m having the same issue.

Iā€™ve changed the host_name in config but Google is still trying to connect to port 8000.

https://mydomain.com:8000?cmd=frappe.integrations.doctype.google_drive.google_drive.google_callback

Iā€™m running on development mode so perhaps I need to change the default bench port from 8000 to 80???

Thank you for your help.

That fixed my issue too. Thanks a lot

So simple ! Thanks a lot.

donā€™t understand what to do . can anyone explain ?

Hi, Iā€™ve added host_name with https://example.com in site config inside the docker container. But thatā€™s not helped me. So, after half an hour researching on docker compose iā€™ve found a temporarily solution is add another port mapping (8000:443) in overrides/compose.https.yaml. and add port example.com:8000 to the google api callback uri.

Ok, thanks you for pointing to the site_config.json file , typo in the address, it solved partially my problem.

I had to add the following URI to the API credentials to get this totally working

https://MY_SITE/api/method/frappe.integrations.google_oauth.callback

thank you it works