This section requires that you have created a Finch application and have access to a client_id and client_secret by completing
the Create a Finch Developer Account
section.
Session Configuration
Every flow requires you to create a Finch Connect session with yourclient_id and client_secret and is configurable with the following parameters:
| Parameter | Required | Description |
|---|---|---|
customer_id | true | A unique identifier for your customer. |
customer_name | true | The name of your customer. |
customer_email | false | The email associated to your customer. |
products | true | A space-separated list of permissions your application is requesting access to. See Product Permissions for a list of valid permissions. Please note that SSN is its own product scope. |
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. |
integration.provider | optional | An optional parameter that allows you to bypass the provider selection screen by providing a valid provider_id from our list of Providers. |
integration.auth_method | optional | An optional parameter that allows you to bypass the provider selection screen by providing a valid auth_method for a provider from our list of Providers. |
sandbox | false | An optional value that allows users to switch on sandbox mode to connect to test environments. Allowed values: finch and provider. For more information, read our testing guide. |
manual | false | An optional value which when set to true displays both Automated and Assisted Providers on the selection screen. |
minutes_to_expire | false | An optional value which allows you to set the number of minutes the connect session should be valid for. Defaults to 30 days. |
connection_id | reauthentication only | A unique identifier created when an employer successfully authenticates through Finch Connect. This ID is only used for reauthentication. You will not have a connection_id for the first call. For all reauthentication flows you should include the connection_id to avoid duplicate connections being created. |
Create a Connect Session
Using the configuration params described in the above sections, your backend application will make a call to Create a New Connect SessionPOST /connect/sessions. When creating the connect session, include your internal customer_id for your customer, the customer’s name and any of the optional fields listed below.
POST /connect/sessions using the same customer_id you passed in, Finch will prompt you to re-authenticate instead and return the following error:
POST / connect/sessions using the same customer_id you passed in, Finch will simply refresh the connect session and return the same session_id. You can do this if you wish to update the Customer Name or any other parameter before your customer connects. If you wish to update any parameters after the customer has connected, you will need to use POST / connect/sessions/reauthenticate.
Best Practices: Creating Sessions
DO
- Always pass in a stable and unique
customer_idfor a given employer, and reuse the samecustomer_idacross retries or drop-offs. Even if an employer opens the Connect session multiple times before successfully connecting, using the samecustomer_idensures all attempts are tracked as a single staged session. - If you think an employer intends to connect multiple entities or payroll systems, you can append an identifier to the
customer_idto differentiate the Connect sessions (e.g.:acme-1,acme-2). Visit this Help Center article for more details.
DON’T
- Avoid generating new
customer_idson retries or failed connection attempts - this results in multiple redundant staged connections and could result in unintended behavior:- If an employer converts using Session_Link_1, Session_Link_2 will eventually expire
- If an employer converts using both Session_Link_1 and Session_Link_2, they will inadvertently create two connections.
Reauthentication Sessions
Your application should be able to generate a Finch Connect session for reathentication. This will avoid creating duplicate connections and ensure that the user is able to reauthenticate successfully to continue syncing data. If a connection goes into a status ofreauth, you will need to create a reauthentication session. This is done by calling Create a new Connect session for reauthentication (POST /connect/sessions/reauthenticate) endpoint with the connection_id of the connection that requires reauthentication. The response will include a new session_id and connect_url for the reauthentication session.
Launch Finch Connect
Finch provides two options to launch Finch Connect: redirect and embedded. For both options, your customer will go through the same authentication flow in Finch Connect. When launching either flow, you may optionally pass a state parameter. Finch Connect sessions are created server-side using your client credentials, so they are not vulnerable to the CSRF attacks thatstate is traditionally used to prevent. The state parameter is not required, but you may use it to carry context through the authorization code exchange or for additional security requirements specific to your application.
Note that state is not a parameter accepted by POST /connect/sessions and will be silently ignored if passed — see the redirect and embedded flow sections below for how to include it in each flow.
Redirect Flow
Use the redirect flow if you are not using the Finch Frontend SDK or need to share a link directly with your customer, such as via email or a URL redirect.- Configure Finch Connect — Create a connect session using
POST /connect/sessions. See Create a Connect Session above for details. - Share Finch Connect — Provide your customer with a link or button pointing to the
connect_url. Your customer clicks it to redirect their browser to Finch Connect, hosted by Finch athttps://connect.tryfinch.com, and initiate the authorization flow. - Request access — Finch Connect prompts your customer to approve the permissions your application is requesting and provide the credentials or information needed to connect their employment system.
- Retrieve the authorization code — After your customer authenticates and grants access, Finch Connect redirects their browser to your
redirect_uriwith a short-lived authorizationcode. - Exchange the code for an access token — Your application exchanges the short-lived
codefor a long-livedaccess_token. See Retrieve An Access Token for details. Theaccess_tokenis then used to make Finch API calls.
connect_url supports an optional state parameter, which will be returned as-is to your redirect_uri after your customer authenticates. To use it, append it to the URL:
Embedded Flow
Use the embedded flow if you are integrating via the Finch Frontend SDK and want your customer to complete the authorization flow within your application.- Configure Finch Connect — Create a connect session using
POST /connect/sessions. See Create a Connect Session above for details. - Share Finch Connect — Provide your customer with a button that calls
connect.open()with thesession_id. Your customer clicks it to launch the Connect modal within your application and initiate the authorization flow. - Request access — Finch Connect prompts your customer to approve the permissions your application is requesting and provide the credentials or information needed to connect their employment system.
- Retrieve the authorization code — Your application receives a short-lived authorization
codevia the SDK’sonSuccesscallback after your customer successfully authenticates. - Exchange the code for an access token — Your application exchanges the short-lived
codefor a long-livedaccess_token. See Retrieve An Access Token for details. Theaccess_tokenis then used to make Finch API calls.
open call accepts an optional state parameter if you need to carry context through the authorization flow:
Finch Connect SDK
Checkpoint + Next Step
After completing this step, you will have successfully integrated Finch
Connect into your application’s front end. This will enable users to
authenticate with their employment systems, providing your application with
the necessary authorization to Retrieve An Access
Token in the next
section.