Custom Catalogs Only
addConnectionmethod should only be used if you are building a custom catalog experience and you want to support more than one connection to a service per user. It is more common to use
connectwhich is a simpler interface.
A unique identifier for this connection. The ID should be unique in the context of your entire platform and can be used to retrieve and modify this connection specifically.
If not supplied, an opaque unique identifier will be generated.
Promise that resolves to the newly created
addConnection kicks off an authorization sequence for the provided
Connector which includes opening a pop-up window, collecting input from the user (e.g. consent to grant access to the 3rd party service), and finalizes the connection (e.g. by retrieving OAuth2 access tokens).
addConnection monitors both the opened popup window as well as a WebSocket connection with Xkit to provide instant feedback to the user in cases of errors and success.
In cases where the connection is successfully created,
addConnection returns the newly created
Connection object with the
enabled attribute set to
In cases where the connection fails,
addConnection will throw errors with descriptive messages as to the source of the error (e.g.
Installation cancelled. if the user closes the pop-up without continuing).
const additionalSlackConnection = await xkit.addConnection("slack", "unique-id")
const additionalSlackConnection = await xkit.addConnection("slack")