Install a connector and authorizer a 3rd party service

🚧

Custom Catalogs Only

The connect method should only be used if you are building a custom catalog experience. xkit-catalog.js already implements connect.

Parameters

  1. connector: Connector | string
    The Connector object for which a new Connection should be created, or a string slug of the Connector.

Returns

Promise<Connection>
A Promise that resolves to the newly created Connection.

connect 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).

connect 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, connect returns the newly created Connection object with the enabled attribute set to true.

In cases where the connection fails, connect 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 slackConnection = await xkit.connect("slack")