Terminal provides a hosted ‘Link’ that makes it easy to authenticate with any telematics provider. With only a few steps you will be able to provide customers/partners an easy self-serve flow to connect their telematics account.
Terminal Link is a user-friendly, hosted page designed to facilitate authentication with any telematics provider. It provides a simple, self-serve flow for customers or partners to connect their telematics accounts.You have two options to integrate Terminal Link into your application:
Directly link to the hosted page.
Embed it within your application using one of our SDKs.
React SDK
JS SDK
Hosted Page
Terminal provides a React hook that makes it easy to embed the link in your application.View the package on NPM here: @terminal-api/link-react
Terminal handles capturing, validating and securely storing customer’s credentials to ensure that each TSP integration is as consistent as possible.Here’s an overview of the steps involved when using the React hook:Steps
Initialize auth link with desired options (see available options below)
Open link and wait for user to complete authentication
In certain scenarios, connections may become disconnected. This can occur when customers modify their password or withdraw access.In such cases, Terminal updates the Connection status to disconnected and prompts you to reauthenticate the customer’s TSP to continue syncing.The reauthentication process mirrors the link flow, but requires the connectionId parameter to specify which connection needs to be updated.
A list of tags that can be used to associate searchable references or categories to your connections. (e.g., ['organizationId', 'Business Unit A']). You can learn more about tags here.
Terminal handles capturing, validating and securely storing customer’s credentials to ensure that each TSP integration is as consistent as possible.Here’s an overview of the steps involved when using the JS SDK:Steps
Initialize auth link with desired options (see available options below)
Open link and wait for user to complete authentication
In certain scenarios, connections may become disconnected. This can occur when customers modify their password or withdraw access.In such cases, Terminal updates the Connection status to disconnected and prompts you to reauthenticate the customer’s TSP to continue syncing.The reauthentication process mirrors the link flow, but requires the connectionId parameter to specify which connection needs to be updated.
// import if using package or will be globally available if installed via script tagimport { TerminalLink } from '@terminal-api/link-sdk';async function exchangePublicToken(publicToken) { // provide the public token to your backend to exchange for a Terminal connection token // store the Terminal connection token in your database to use for future Terminal API requests const response = await fetch('/api/create-terminal-connection', { method: 'POST', body: JSON.stringify({ publicToken }), }); return response.json();}const link = TerminalLink.initialize({ // production or sandbox publishable key from the Terminal dashboard publishableKey: process.env.TERMINAL_PUBLISHABLE_KEY, onSuccess: (result) => exchangePublicToken(result.publicToken),});link.open();
A list of tags that can be used to associate searchable references or categories to your connections. (e.g., ['organizationId', 'Business Unit A']). You can learn more about tags here.
Date to start backfilling from. Defaults to current date.
The easiest way to get started with Terminal is to redirect your users to our hosted link. This is a great option if you don’t want to embed the link in your application or if you are using a language that we don’t have an SDK for.We will handle the entire authentication flow and redirect the user back to your application when they are done.
Terminal handles capturing, validating and securely storing customer’s credentials to ensure that each TSP integration is as consistent as possible. Here’s an overview of the steps involved in that flow.Steps
Create auth link with desired options (see available options below)
Ask user to login to their TSP and direct to link
User is redirected back to the redirect_url with the following paramaters:
result: Indicates the outcome of the authentication process. It will be either:
success: The user successfully authenticated.
exit: The user exited the authentication process without completing it.
token: A public token that is provided when result === success. This token is used to exchange for a connection token on your backend.
state: An opaque value that you can set in the link params for additional security:
If provided in the initial request, it will be returned unchanged.
You should compare the returned state with the one you initially set.
If they don’t match, it may indicate a potential security issue (e.g., a CSRF attack), and you should abort the authentication process.
Pass public token to your backend and exchange public token for a connection token
Wait for initial sync to complete by either:
Polling /connections/current until sync is complete
There are rare times where connections may get disconnected. Common reasons for this include when customers change their password or revoke access.When this happens - Terminal will update the status of the Connection to disconnected and prompt you to reauthenticate the customer’s TSP in order to resume syncing.Reauthentication is similar to the link flow but includes the connectionId in the URL path to denote which connection you would like to update.Steps
Get re-auth link for disconnected connection (see example below)
Explain to user they need to enter their credentials again and direct them to link to perform authentication
Resume ingesting data after catch up sync completes
Example Link
Here’s an example of a Link URL for re-authenticating existing connections:
Special NoteDuring re-auth, you must link the same TSP account. Should your customer want to change accounts then they will need to create a new connection
You can use the following options when directing customers to the link in order to control behaviour. Please note these settings do not apply to the re-authentication flow.
The base URL for the link is determined by the environment you are using. You can use the following table to determine which environment you should use.Our SDKs automatically determine the correct base URL based on the publishable key you provide.
Where you want to direct users after they succesfully complete or exit the link flow. This is required for initial authentication in order to exchange the public token but is optional during re-authentication.Example: https://app.example.com/telematics-success
Optional state parameter for maintaining application state and preventing CSRF
attacks. This opaque value is returned unchanged, allowing verification of the
request source. It should be unique for each flow initiation.
A list of tags that can be used to associate searchable references or
categories to your connections. Tags can be passed as a string of
comma-separated values. You can learn more about tags
here.