Embedding authentication

Polytomic Connect handles authentication to your customers’ systems so you do not have to build input forms or OAuth flows yourself. It works with databases, data warehouses, CRMs, cloud buckets, spreadsheets, and arbitrary HTTP APIs.

With a single API call, you can open a Polytomic-generated auth modal for any supported integration. For example, Polytomic Connect generates these modals for HubSpot and Snowflake:

HubSpot

Snowflake


Polytomic supports many other integrations. You can open an auth modal for any of them without knowing which parameters each one requires.

Restricting integrations

Use the whitelist parameter to restrict which integrations customers can connect to.

Pass a single-element array to allow only one integration — for example, ["salesforce"] sends the user straight into the Salesforce auth form.

Pass multiple values — for example, ["salesforce", "hubspot"] — to present the user with a picker first, then the auth form for their selection.

Dark mode

Set the dark parameter to true to render the modal in dark theme.

The auth modal can display your company’s logo instead of Polytomic’s. To enable this, email an SVG of your logo to support@polytomic.com. Below are light- and dark-mode examples with a custom logo in the top left and a restricted integration list:

Light mode Dark mode

Connect modal initialization

Steps

1

Obtain an API key

If you do not already have one, see obtaining an API key.

2

Request a connect redirect URL

Call /api/connections/connect with the connection types and any additional parameters. Make this call once per user connection.

3

Open the connect modal

Send the user to the URL returned in the redirectURL field.

Request parameters

NAME
TYPE
DESCRIPTION
REQUIRED
namestringThe name of the connection. Connection names must be unique within an organization.true
redirectURLstringThe URL to redirect to after the connection is authenticated.true
whiteliststring[]A list of connection types to whitelist.false
darkbooleanWhether to use the dark theme.false

Code example

The following example authenticates to PostgreSQL through the Polytomic Connect API. The caller does not need to know which inputs PostgreSQL requires — Polytomic Connect handles that.


Proxy the request through a backend server so your API token stays off the client. The example is split into frontend and backend.

1const REDIRECT_URL = "http://localhost:8080/connect_complete";
2
3async function initiatePolytomicConnect() {
4 const response = await fetch(`/_/api/connections/connect`, {
5 method: "POST",
6 mode: 'cors',
7 cache: 'no-cache',
8 credentials: 'same-origin',
9 body: JSON.stringify({
10 name: "My connection",
11 whitelist: ["salesforce", "hubspot", "marketo", "outreach"],
12 redirect_url: REDIRECT_URL,
13 dark: true,
14 }),
15 });
16 if (response.ok) {
17 const data = await response.json();
18 window.open(data.data.redirect_url, "_blank")
19 return;
20 }
21 const { error } = await response.json();
22 throw new Error(error);
23}