import Conductor from "conductor-node";
const conductor = new Conductor("{{YOUR_SECRET_KEY}}");

const endUser = await conductor.authSessions.create({
  publishableKey: "{{YOUR_PUBLISHABLE_KEY}}",
  endUserId: "{{END_USER_ID}}",
});
{
  "id": "int_conn_auth_sess_1234567abcdefg",
  "objectType": "auth_session",
  "endUserId": "end_usr_1234567abcdefg",
  "clientSecret": "auth_sess_client_secret_1234567abcdefg",
  "authFlowUrl": "https://connect.conductor.is/qbd/auth_sess_client_secret_1234567abcdefg?key={{YOUR_PUBLISHABLE_KEY}}",
  "expiresAt": "2022-11-16 23:51:08.996+00",
  "redirectUrl": null
}

To launch the IntegrationConnection authentication flow, create an AuthSession. Pass the returned session’s authFlowUrl to the client for your end-user to launch the IntegrationConnection authentication flow.

Parameters

publishableKey
string
required

Your Conductor publishable key, which we use to create the session’s authFlowUrl.

endUserId
string
required

The ID of the EndUser for whom to create the IntegrationConnection.

linkExpiryMins
integer
default: 30

The number of minutes after which the AuthSession will expire. Must be at least 15 minutes and no more than 7 days. If not provided, defaults to 30 minutes.

redirectUrl
string

The URL to which Conductor will redirect the end-user to return to your app after they complete the authentication flow. If not provided, their browser tab will close instead.

Returns

Returns the AuthSession object.

import Conductor from "conductor-node";
const conductor = new Conductor("{{YOUR_SECRET_KEY}}");

const endUser = await conductor.authSessions.create({
  publishableKey: "{{YOUR_PUBLISHABLE_KEY}}",
  endUserId: "{{END_USER_ID}}",
});
{
  "id": "int_conn_auth_sess_1234567abcdefg",
  "objectType": "auth_session",
  "endUserId": "end_usr_1234567abcdefg",
  "clientSecret": "auth_sess_client_secret_1234567abcdefg",
  "authFlowUrl": "https://connect.conductor.is/qbd/auth_sess_client_secret_1234567abcdefg?key={{YOUR_PUBLISHABLE_KEY}}",
  "expiresAt": "2022-11-16 23:51:08.996+00",
  "redirectUrl": null
}