Embedding a Connect Webview in Your App
Use redirection or an iframe to embed a Connect Webview in your app.
Last updated
Use redirection or an iframe to embed a Connect Webview in your app.
Last updated
© Seam Labs, Inc. All rights reserved.
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:
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.
You can redirect to the Connect Webview URL or use an iframe to display the Connect Webview. The following sections describe these two options:
To incorporate a Connect Webview in your app using redirection:
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.
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
To incorporate a Connect Webview in your app using an HTML iframe:
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.
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:
Learn when the device or ACS account connection has completed successfully. When the connection completes successfully, you can close the iframe.
If you want to include a Connect Webview flow inside an iOS or Android app, it is important to note that iOS and Android require verification for each link to which a user navigates within an app. Consequently, you must register a navigation delegate to handle any links within the Connect Webview. For example, there is a link from the Connect Webview to the Seam Privacy & Legal webpage. This link includes target=_blank
in the anchor tag to open the privacy policy in a new tab or window. You must configure your iOS or Android app to handle opening links in a new browser tab or window.
The following example shows how to handle all links to URLs that are not in the getseam.com
or seam.co
domain within a Connect Webview embedded in an iOS or Android app:
For details, see the following relevant iOS or Android documentation: