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:

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


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.

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 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 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


thank you it works