Repository navigation
Conversation
Each Clio region is a separate instance with its own OAuth server and
developer app, and tokens are not valid across regions. The module sent
every OAuth exchange to app.clio.com with the US app's credentials, so
non-US accounts could not connect.
- setRegion() now switches the API base URL, OAuth authorize/token URLs
and client credentials together; the constructor goes through it
- getToken honours params.region so the code is exchanged in the region
that issued it (Quo sends { code, region: "ca" })
- new CLIO_{EU,CA,AU}_CLIENT_ID/SECRET env vars; a region without its
own credentials falls back to CLIO_CLIENT_ID/SECRET
- a saved region of null or '' is treated as US
- first unit tests for the package (region routing, exchange, refresh)
US behaviour is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Live test against a Clio Canada accountTested
This also confirms the OAuth host for Clio Manage in Canada is Credential probes with a dummy code back up the per-region setup: the CA app's credentials return US behaviour unchanged: default region, same URLs, same 🤖 Generated with Claude Code |
Why
Clio runs each region (US, EU, CA, AU) as a separate instance. Per Clio's docs, each region needs its own developer application (different client ID/secret), and "a token issued in one region is not valid against another region's API" (Regions, Applications).
The module hardcoded OAuth to
app.clio.comwith the US app's credentials and ignored the region sent at authorization time, so non-US accounts couldn't connect. Quo is adding a "Clio (Canada)" app that sends{ entityType: "clio", data: { code, region: "ca" } }.What changed
api.ts: one host per region;setRegion()now switches the API base URL, OAuth authorize/token URLs and client credentials together. The constructor goes throughsetRegion(), so an entity persisted withregion: "ca"loads (and refreshes tokens) againstca.app.clio.com.definition.ts:getTokenhonoursparams.regionbefore exchanging the code. NewCLIO_{EU,CA,AU}_CLIENT_ID/CLIO_{EU,CA,AU}_CLIENT_SECRETenv vars, passed to theApiasregional_credentials. A region without its own credentials falls back toCLIO_CLIENT_ID/CLIO_CLIENT_SECRET.nullor''is treated asus(core'sget()only defaults onundefined).test/regions.test.ts, 10 tests): US default, persisted region, credential fallback, switching back to US, invalid region, code exchange with/without region, token refresh in the persisted region. The 4 region tests fail against the previous code.Compatibility
US behaviour is unchanged: same URLs, same
CLIO_CLIENT_ID/SECRET, no new env vars required. Checked the consuming app's data read-only: all Clio entities in dev (4) and prod (171) are persisted withregion: "us".Testing
npx tsc -p tsconfig.jsonandnpx vitest runinpackages/v1-ready/clio(10/10).ca.app.clio.com/oauth/*follows from the API host and will be confirmed by that test.🤖 Generated with Claude Code
📦 Published PR as canary version:
Canary Versions✨ Test out this PR locally via:
npm install @friggframework/api-module-clio@1.1.0-canary.103.daa1c68.0 # or yarn add @friggframework/api-module-clio@1.1.0-canary.103.daa1c68.0