---
name: saaslayer-sdk-integration
description: Integrate SaaSLayer JavaScript, React, embedded UI or Permissions SDKs into an existing application. Use when adding sign-in, account UI or permission checks with an agent.
---

# Integrate an SDK into your app

## Instructions

Inspect the application's framework, existing sign-in provider and installed package versions before choosing a SaaSLayer SDK. Keep existing authentication when the task only needs Permissions. Use JavaScript for framework-independent integration, React for React components/hooks, embedded UI for ready-made web components, and the portable Permissions client for API access.

Read version-matched docs from the installed package's AGENTS.md and topic files when they exist. Otherwise inspect its installed declarations and README, and compare the version with the current references at https://saaslayer.com/docs/reference/javascript.md, https://saaslayer.com/docs/reference/react.md, https://saaslayer.com/docs/reference/embedded-ui.md and https://saaslayer.com/docs/reference/permissions.md. Do not assume a newly documented export exists in an older installed package. Ask before upgrading a dependency or replacing the application's auth architecture.

Read https://saaslayer.com/docs/users/quickstart.md, https://saaslayer.com/docs/permissions/quickstart.md or https://saaslayer.com/docs/embedded-ui/overview.md for the selected integration. Reuse the application's deployment coordinates and current environment. Ask for missing non-secret configuration. Keep private API keys, refresh tokens and signing credentials out of browser bundles, logs and chat. UI visibility checks improve UX; enforce authorization on the application's server before accessing protected data.

Use only exports present in the installed package. Add a small integration and verify it with the project's typechecker and relevant tests. Dispose subscriptions/controllers when their UI is removed. Do not deploy services, change browser origins, publish the app or send invitations as an implied part of a local SDK edit. Report which checks passed and which need a real deployed environment.
