@embedhq/react
v0.1.5
Published
This SDK makes it easy to connect end-user accounts to integrations like Dropbox, Slack, HubSpot, and more. For a detailed overview of the auth flow, refer to [the docs](https://docs.useembed.com/). If you're _not_ using React (or a React-based framework
Downloads
5
Readme
Embed Connect React SDK
This SDK makes it easy to connect end-user accounts to integrations like Dropbox, Slack, HubSpot, and more. For a detailed overview of the auth flow, refer to the docs. If you're not using React (or a React-based framework like Next.js), use the JavaScript SDK instead.
Installation
Download the SDK from NPM.
npm install @embedhq/react
Usage
First, generate a session token server-side, then use it to call the connect()
function exposed by the useEmbedConnect
hook as shown below.
import { useEmbedConnect } from "@embedhq/react";
export function MyComponent() {
const { connect } = useEmbedConnect();
async function initiateAuthFlow() {
try {
const response = await connect("SESSION_TOKEN");
console.log(response.connectionId);
} catch (err) {
console.error(err);
}
}
return <button onClick={initiateAuthFlow}>Connect</button>;
}