sage-accounting-oauth-app
Sage Accounting OAuth2 App Registration
Get a working Sage Accounting OAuth2 client — a Sage App Registry account, a registered app, callback URLs, a client ID and a client secret — for a platform that connects many customers' Sage Accounting businesses.
Sage's registration form is the easiest part of this job. Four things outside the form decide whether the integration works, and all four are silent failures.
Sage Accounting is sold per country, and the country is part of the auth flow. The v3.1 API serves exactly three countries — the UK, Ireland and Canada — behind one API host but two regional authorization servers. If the country the user picks does not match the country their business is registered in, authorization fails. That is §7.
One token reaches every business the user can see, and you get the wrong one by default. A Sage access token belongs
to a user, not a business. Unless you send an X-Business header, every call resolves against that user's lead
business — the first business they ever created. For an accountant on Partner Edition with forty client businesses,
that is the accountant's own practice file. That is §8.