Zoho Mail generates an invalid API host for Canadian accounts
Problem
The built-in zoho-mail provider cannot proxy normal API requests for accounts hosted in Zoho's Canadian data centre.
The provider currently builds its Mail API base URL as:
https://mail.zoho.${connectionConfig.extension}With the Canadian data-centre extension ca, this becomes https://mail.zoho.ca. That hostname is not the Canadian Zoho Mail API: it serves an unrelated website and returns HTML/404 responses for Mail API paths.
Zoho documents the Canadian Mail API base URI as https://mail.zohocloud.ca and the Canadian Accounts/OAuth server as https://accounts.zohocloud.ca.
Reproduction
Using a valid, read-only Canadian Zoho Mail OAuth connection:
GET /api/accountsthrough the provider-generatedhttps://mail.zoho.cabase returned HTTP 404 with HTML from an unrelated site.- The same request and OAuth token with a temporary
base-url-override: https://mail.zohocloud.careturned HTTP 200 and the expected Zoho Mail API response. - Sending the same regional token to the US Mail host returned
401 INVALID_OAUTHTOKEN, confirming that the Canadian service host is required.
No account, connection, mailbox, or credential identifiers are included here.
Root cause
The Mail provider assumes every Zoho data-centre code can be appended to mail.zoho.. Canada is an exception: the data-centre code remains ca, but both the Mail and Accounts hosts use zohocloud.ca.
Adding only ca to the current enum would therefore preserve the broken mail.zoho.ca result. Changing the extension itself to zohocloud.ca would also be incorrect because it would produce malformed hosts in shared Zoho OAuth/API templates.
Suggested fix
A backward-compatible provider fix can:
- accept and label
cain thezoho-mailconnection configuration; - map only the resolved Mail base
https://mail.zoho.catohttps://mail.zohocloud.ca; - map the Canadian authorization host to
accounts.zohocloud.ca; - prefer the existing
accounts-serverredirect metadata for token exchange, retaining the extension-based fallback for stored non-Canadian connections; - leave US, EU, India, Australia, China, and Japan unchanged; and
- document the Canadian host exception.
I have a focused implementation with regression coverage proving Canada resolves to mail.zohocloud.ca, US/EU remain unchanged, the schema accepts ca, and the existing Accounts redirect-metadata path still works. I can submit it as a PR if maintainers would like one.
Official Zoho documentation
- Zoho Mail API data-centre base URIs: https://www.zoho.com/mail/help/api/getting-started-with-api.html
- Zoho OAuth multi-data-centre support: https://www.zoho.com/developer/oauth/multi-dc-support.html
Related Nango OAuth metadata support: #4804
Source: NangoHQ/nango