Re-Authentication
Once the end customer goes through the auth flow, Cobalt saves the encrypted tokens and keys and refreshes them if/when required to maintain the functionality of the created workflows.
However, there are certain conditions where Cobalt can no longer authenticate the API on behalf of your end customers.
- The provided API credentials for eg: API keys, Refresh token has expired.
- The access token or refresh token of the end customer has been revoked.
- The end customer uninstalls the application.
- The user deletes the application being used by their customer.
Handling re-auth
When any of the above mentioned scenarios occur, Cobalt sets a flag reauth-required
for the application integration of the customer. You could find this
in the application response object. See below -
below is a sample response with an application with expired authentication.
This re-authentication flow is handled by the Hosted flow and the Embedded flow where the user would be asked to re-connect if the application authentication has expired.
If you have been using the Seamless flow for customizing the code on the client side, just check for the reauth_required
field in the application list response,
and use the .connect()
method to connect to the application again.
Checkout the auth methods for more details.
Getting notified using webhook.
Cobalt supports webhook subscription for an event when an application auth gets expired for a linked account. You would need to subscribe for the event Connection Expired
.
Cobalt would then notify you whenever an app connection expires and provide details about the application and the account.