Redirect URLs are used to direct the user in your application after authenticating with an integration.
Audience
This guide is for users wanting control over the user journey after authentication and specifically dynamically changing the host the user is sent to.
Pre-requisites
You will need to be an admin within the Codat portal to complete these steps.
Using Variables Redirect and Callback URL's
If you would like users to be redirected to a specific point within your application, you can configure this on the Link settings page within the portal.
For example, if you would like all users to be redirected to https://www.codat.io/ once they have completed the authorisation process you would need to go through the following steps -
Add the redirection domain to the whitelist
Once added, you can then add a variable within the redirect URL parameter:
Once you have done this you must append the variable in the parameter in the linkUrl (dataConnections[i].linkUrl), or the redirect property if using the Codat link flow that you serve to the customer for authorisation e.g.
https://link.codat.io/companies/{companyId}/connections/{connectionId}/start?redirectUrl=https://www.codat.io/
Once authorised, your user would then be redirected to https://www.codat.io/
You could either provide the full URL each time like the example above, or you can set the redirect to be a part of the URL like the environment e.g.
Ensuring that you update the whitelist with the valid options.
Similarly, you can then provide this in the Link url for the customer to authorise e.g.
https://link.codat.io/companies/{companyId}/connections/{connectionId}/start?environment=app
The customer would then be redirected to https://app.codat.io/ once they have authorised their connection.
Please note that if either the parameter is not provided in the URL or a parameter is provided that not complete a URL from Allowed redirect URLs list a 400 error will be returned to the user.
If you have any questions on the information shared above, contact support@codat.io.