Repair a connection to a 3rd party service
Custom Catalogs Only
The
reconnectmethod should only be used if you are building a custom catalog experience. xkit-catalog.js already implementsreconnect.
Parameters
connection:Connection
TheConnectionobject which needs to be repaired.
Returns
Promise<Connection>
A Promise that resolves to the newly created Connection.
reconnect kicks off an authorization sequence similar to connect but takes an existing Connection as its parameter instead of a Connector. The behavior of reconnect is otherwise quite similar.
In cases where the connection is successfully re-established, the returned Connection object will have the enabled property set to true and will have an authorization property.
In cases where the connection fails, reconnect will throw errors with descriptive messages as to the source of the error (e.g. Cancelled authorization if the user closes the pop-up without continuing).
const existingConn = await xkit.getConnection("slack")
if (!existingConn.authorization) {
const newConn = await xkit.reconnect(existingConn)
}
