You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-30Lines changed: 29 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,8 @@ The built files will be in the `dist` directory.
36
36
37
37
## Usage
38
38
39
+
### Authentication
40
+
39
41
To use this library, you will first need to fetch an Airbyte Embedded token. You should do this in your server, though if you are simply testing this locally, you can use:
`AIRBYTE_BASE_URL`: where your Airbyte instance is deployed
52
54
`CUSTOMER_WORKSPACE_ID`: the workspace you have associated with this customer
53
-
`EMBEDDING_ORIGIN` here refers to where you are adding this widget to. It will be used to generate an `allowedOrigin` parameter for the webapp to open communications with the widget. If you are running the widget locally using our demo app, the allowed origin should be `https://localhost:3003`, for example.
55
+
`EMBEDDING_ORIGIN` here refers to where you are adding this widget to. It will be used to generate an `allowedOrigin` parameter for the webapp to open communications with the widget.
54
56
55
57
You can also, optionally, send an `externalUserId` in your request and we will attach it to the jwt encoded within the Airbyte Embedded token for provenance purposes.
56
58
57
59
Embedded tokens are short-lived (15-minutes) and only allow an end user to create and edit Airbyte source configurations within the workspace you have created for them.
58
60
59
-
These values should be passed to where you initializze the widget like so:
61
+
### Event Callbacks
62
+
63
+
The widget also accepts an `onEvent` function as an argument. This function, if provided, will be executed when a user completes the integration setup or update flow. These events have the following format:
data: PartialUserConfigRead; // an object containing all data related to the user's configuration, including an actorId identifying the source created/updated
Copy file name to clipboardExpand all lines: demo/README.md
+21-24Lines changed: 21 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,42 +18,39 @@ This is a demo application showcasing the usage of the Airbyte Embedded Widget.
18
18
pnpm install
19
19
```
20
20
21
-
2. Fetch embedded token
22
-
23
-
To use this library, you will first need to fetch an Airbyte Embedded token. You should do this in your server, though if you are simply testing this locally, you can use:
`AIRBYTE_BASE_URL`: where your Airbyte instance is deployed
36
-
`CUSTOMER_WORKSPACE_ID`: the workspace you have associated with this customer
37
-
`EMBEDDING_ORIGIN` here refers to where you are adding this widget to. It will be used to generate an `allowedOrigin` parameter for the webapp to open communications with the widget. If you are running the widget locally using our demo app, the allowed origin should be `https://localhost:3003`, for example.
32
+
4. Start the backend server
38
33
39
-
You can also, optionally, send an `externalUserId` in your request and we will attach it to the jwt encoded within the Airbyte Embedded token for provenance purposes.
34
+
```bash
35
+
env $(cat .env | xargs) node server.js
36
+
```
40
37
41
-
Embedded tokens are short-lived (15-minutes) and only allow an end user to create and edit Airbyte source configurations within the workspace you have created for them.
38
+
The server will start at `https://localhost:3001`.
42
39
43
-
3. Create a `.env` file in the `/demo` directory:
40
+
This server will be responsible for fetching your Airbyte Embedded token and sending it to the Embedded Widget. It is also called from the frontend of the demo to log the event responses from Airbyte when a user sets up or updates an integration.
44
41
45
-
```env
46
-
VITE_AB_EMBEDDED_TOKEN=""
47
-
```
42
+
5. Start the frontend server:
48
43
49
-
You can fetch an Airbyte Embedded token using the curl request example above.
44
+
```bash
45
+
npx serve .
46
+
```
50
47
51
-
4. Run the demo app using `pnpm dev` and access a very simple example UI at `https://localhost:3003` in your browser.
48
+
You may need to accept the self-signed certificate warning in your browser.
52
49
53
50
## Project Structure
54
51
55
-
-`index.html` - Main HTML file with widget container
56
-
-`vite.config.ts` - Vite configuration with HTTPS setup
52
+
-`/public/index.html` - Main HTML file with widget container
53
+
-`server.js` - Backend server requesting the embedded URL
57
54
-`.env` - Environment variables (not committed to git)
0 commit comments