In this guide, you’ll integrate Chart Connect into your application’s frontend.
Parameter | Required | Description |
---|---|---|
client_id | true | Your client_id , a unique identifier for your application. |
redirect_uri | redirect only | The URI your user is redirected to after successfully granting your application access to their system. This value must match one of your application’s configured redirect URIs. |
state | optional | An optional value included as a query parameter in the response back to your application. This value is often used to identify a user and/or prevent cross-site request forgery. |
npm install --save @chartapi/react-connect
yarn add @chartapi/react-connect
<script src="https://cdn.trychart.com/script.js"></script>
Since Chart Connect is an iFrame that requires interactivity, the HTML page that is loading Chart Connect must be served from a server. If the page is hosted statically, Chart Connect will not work properly.
client_id
.
You can find this client_id
in your Chart Developer Dashboard.
https://connect.trychart.com
. After a successful connection,
Chart Connect will redirect your user back to a URI you specified (redirect_uri
) with a short-lived authorization code
.
Set the redirect_uri
parameter to the URL where users will be redirected after completing the authentication flow.
The redirect_uri
must be set in the Chart Developer Dashboard. Otherwise, the request will fail.
redirect_uri
with a short-lived authorization code
.access_token
that represents your application’s access to your user’s tax system.onSuccess
event is called by the SDK, simply pass the code
to your internal callback endpoint as a query parameter.
NOTE: You should not include a redirect_uri
if using the embedded flow.
Because the entire flow is already self-contained in your app, no redirect is necessary.
onSuccess
and onError
.
onSuccess
: This event is triggered when the user completes the authentication process.
It returns an authorization code
that you will use to obtain an access_token
in the next step.
Pass this authorization code
securely and temporarily to the access token exchange function.onError
: This event is triggered if there’s an issue during the authentication process.
Your application should handle this error gracefully, either by displaying an error message to the user or retrying the authentication flow.onClose
: This event is triggered when a user exits the Chart Connect model, either by closing the modal or clicking outside the modal.