Re-authentication Flow
Finch aims to ensure your application maintains long-lived access to your customers' providers. However, when a customer changes security settings on their account or a provider makes changes to its infrastructure, Finch's connection can get disconnected. This will result in an error with the HTTP status code of 401
and finch_code
of reauthenticate_user
. When an access token returns this error, your customer will need to re-authenticate by going through the Automated Finch Connect Flow again.
General re-authentication flow
Finch recommends the following steps to handle re-authentication:
- Catch
401
HTTP status code errors responses with thefinch_code
=reauthenticate_user
(see handling Finch API errors) in your application. - Construct the correct Finch Connect authorization URL for your customer to re-authenticate. To create a more seamless experience, you can bypass the provider selection page by using the
payroll_provider
parameter. You can find thepayroll_provider
of your customer by calling the/introspect
endpoint with theiraccess_token
. - Notify your customer their connection has gone stale and they can resolve it by re-connecting their account. To increase conversion, we recommend letting your customer know why re-connecting is beneficial to them and the services that will not work until they reconnect.
- Once your customer goes through Finch Connect successfully again, an authorization
code
is generated which you will need to exchange for a newaccess_token
that you can use to send requests to the Finch API. Make sure to save this new token in your database.
While you will have a new
access_token
for your customer, everything else will remain the same. All Finch identifiers, likeindividual_id
orbenefit_id
, are the same across tokens.
Considerations
Notifying customers
We recommend either using in-app or email notifications to notify your customer there is an issue with their connection, why reconnecting is beneficial, and the steps they need to follow to reconnect.
Presenting Finch Connect
Below are a couple of options to present the reconnection flow to your customers:
- Prompt your customer to log on to their application dashboard where you can present them the website page to launch through Finch Connect again.
- Send your customer an authorization URL with a
redirect_uri
that redirects them back to their application dashboard after a successful reconnection.