Embedding a Connect Webview in Your App

Use redirection or an iframe to embed a Connect Webview in your app.

To enable your users to connect their devices or access control system to Seam through your app, use a Connect Webview. First, in your app, add a mechanism—such as a button—to open a new Connect Webview. Then, you can use either of the following two methods to display the Connect Webview in your app:


Step 1: Open a Connect Webview

To enable users to connect their devices or access control system with your app, present a button to create and display a new Connect Webview. If your app has a settings section, we recommend creating a device or ACS settings page and displaying an Add or Link button, such as Add Devices.

When your user clicks this button, your app can either redirect to the Connect Webview URL or embed the Connect Webview in an iframe and present it in a modal.


Step 2: Display the Connect Webview

You can redirect to the Connect Webview URL or use an iframe to display the Connect Webview. The following sections describe these two options:

Redirect to the Connect Webview URL

To incorporate a Connect Webview in your app using redirection:

  1. Create the Connect Webview.

    • Make sure to set a custom_redirect_url so that the Connect Webview redirects back to the desired page within your app after the Connect Webview flow completes.

    • If you want to redirect to a different page when there is an error, you can set the custom_redirect_failure_url to the URL for the desired page.

    • We recommend setting wait_for_device_creation to true so that the Connect Webview does not complete until Seam completes the first sync of the connected account and devices or ACS.

  2. Redirect your app to the URL for the created Connect Webview. Pass the Connect Webview url to the client portion of your app and redirect your app to this URL. The resulting page displays the authorization flow through which your app user can link their device or ACS account to Seam.

    Once the user has completed the authorization flow, the Connect Webview redirects back to your app (specifically to the custom_redirect_url). Note that Seam appends the following search parameters to the URL after the redirect:

    • connect_webview_id

    • If there is an error, error_code and error_message


Embed the Connect Webview in an iframe

To incorporate a Connect Webview in your app using an HTML iframe:

  1. Create the Connect Webview. We recommend setting wait_for_device_creation to true so that the Connect Webview does not complete until Seam completes the first sync of the connected account and devices or ACS.

  2. Display the URL for the created Connect Webview in an iframe. Pass the Connect Webview url to the client portion of your app and use an HTML iframe to display the Connect Webview URL.

    For example:

    <iframe style="border: none;min-height: 600px;height: 100%;width: 100%"
    allow="clipboard-write"
    src="<your connect_webview.url>"
    />
  3. Learn when the device or ACS account connection has completed successfully. When the connection completes successfully, you can close the iframe.

Last updated

Logo

© Seam Labs, Inc. All rights reserved.