Skip to content

Authentication

When a user enables your integration for a team or a site, they authenticate the integration. This authentication allows the integration to call API handlers. This is necessary for things such as installing a build event handler on a site, enabling a connector on a team, configuring environment variables, and interacting with any other Netlify API.

How users enable integrations

When an integration is published, an integration card is added to the Integrations tab in the Netlify UI. The integration card includes an option to Enable the integration. When a user selects Enable, the integration is enabled and authenticated. Users can enable integrations on a team level, site level, or both. Learn more about integration levels.

To check out the integrations that are currently published, log in to Netlify and select Integrations.

Customize the flows

It is possible to customize the enable and disable flows to add additional logic. For example, you can add a step to the enable or disable flow that interacts with a third-party API.

Customize the enable flow

To customize the enable flow, use the onEnable method. This method allows you to add logic that runs after the integration is enabled for a site or team.

// src/index.ts
import { NetlifyIntegration } from "@netlify/sdk";

const integration = new NetlifyIntegration();

integration.onEnable(() => {
  // ... logic to run after the integration is enabled for a site or team
});

If you are creating an integration with Connectors or Build Event Handlers, you will need to customize this flow to enable the components. Learn more in the docs for Connectors and Build Event Handlers.

Customize the disable flow

To customize the disable flow, use the onDisable method. This method allows you to add logic that runs before the integration is disabled for a site or team. This ordering makes it possible to add a step to the disable flow that interacts with a third-party API. For example, to add a step that deletes a resource that was created when the integration was enabled.

// src/index.ts
import { NetlifyIntegration } from "@netlify/sdk";

const integration = new NetlifyIntegration();

integration.onDisable(() => {
  // ... logic to run before the integration is disabled for a site or team
});

Test your authentication

Use the Integration UI preview mode to preview your integration card and test your authentication flow. This preview mode allows you to test your authentication flow without publishing your integration.