Google Calendar integration - redirect_uri_mismatch error (Home Assistant + Cloudflare Tunnel)

I am trying to integrate Google Calendar with Home Assistant, but the OAuth flow consistently fails with:
Error 400: redirect_uri_mismatch

Setup

2026.4.2

  • Home Assistant running behind Cloudflare Tunnel
  • External URL:
    https://mydomain.aa
  • Internal URL:
    http://192.168.1.xx:8123
  • Using Google Cloud OAuth credentials (Web application)
  • Google Calendar API is enabled
  • Home Assistant is accessed publicly via the domain successfully (works from mobile 4G)

Configuration (Home Assistant)

homeassistant:  internal_url: "http://192.168.1.xx:8123"  external_url: "https://mydomain.aa"http:  use_x_forwarded_for: true  trusted_proxies:    - 172.30.33.0/24    - 127.0.0.1    - ::1

### Problem
When starting the Google Calendar integration, the OAuth flow redirects to:
https://my.home-assistant.io/redirect/oauth
instead of the expected callback URL:
https://mydomain.ch/auth/external/callback
This causes Google to reject the authentication with:
> Error 400: redirect_uri_mismatch
### What I already tried

* Verified Google Cloud OAuth redirect URI configuration
* Ensured correct external URL in Home Assistant
* Removed and recreated Google integration
* Restarted Home Assistant
* Cleared browser cache
* Confirmed Cloudflare Tunnel is working correctly
* Confirmed HTTPS access to Home Assistant domain works externally

### Expected behavior

Home Assistant should use:
https://mydomain.aa/auth/external/callback
as the OAuth redirect URI.
### Actual behavior
Home Assistant uses:
https://my.home-assistant.io/redirect/oauth
which causes the mismatch in Google OAuth.
******
If anyone has seen this with Cloudflare Tunnel + Home Assistant Google integration, I would appreciate guidance on what is forcing the my.home-assistant.io redirect instead of the configured external URL
****
if cloudflare is not supported with google calendar, should be written somewhere in the documentation

If you have tried installation before, then make sure to delete the relevant integration credentials:

  • settings
  • devices and services
  • upper right 3 points ---) application credentials

and try installation again

thanks. I had this problem at the beginning but message was "acces denied". so I have recreated a client id.