The flow
Authorize (one-time, interactive)
Send the user to the
/authorize URL. They log in to TaxRock and consent to
read:client-accounts, and TaxRock redirects to your registered callback with
?code=.... Generate the code_challenge from a code_verifier (PKCE, S256) and
keep the verifier for the next step.Exchange the code (backend)
POST the
code, code_verifier, and client_secret to the token endpoint to
receive an access_token and a refresh_token. Store the refresh token securely,
per end-user.Tokens
- Access token — short-lived, about an hour. Cache and reuse it rather than minting
one per request. Send it as a
Bearercredential. - Refresh token — non-rotating, so keep using the same one; the refresh response returns no new refresh token. It expires after about 100 days idle, with an absolute maximum lifetime of about 365 days, after which the user must reconnect even if active.
audience— an access token is only valid for the audience it was requested for, so includeaudienceon the refresh call.
Refresh
When a user must reconnect
A refresh that returnsinvalid_grant, or an API response of 401, means that user’s
connection is broken. invalid_grant happens when the refresh token expired: it sat
idle past ~100 days, reached its ~365-day maximum, or was revoked. Send the user back
through the authorize step and surface a “Reconnect TaxRock” action. This is normal
steady-state behavior, not an error to alarm the user with.
A 403 from the API is different: the connected user lacks the required permission,
which re-consent will not fix, so treat it as a configuration issue rather than a
reconnect.
We will give advance notice if a change ever requires re-consent (for example, a new
scope). Watch the Changelog.
PKCE
For more on generating thecode_challenge and code_verifier, see
RFC 7636.
