Overview
Seam Components may be used on any website, in any web app, and with any framework. For this guide, we expect you to have a backend server and a client frontend react application. If you want to integrate Seam using only a client without a backend, you’ll need to use a Publishable Key. Seam provides React components and hooks to connect and control many types of smart devices. This guide provides a rapid introduction to using React components with Client Sessions.What is a Client Session Token?
A Client Session Token allows a device owner to make API requests to Seam where interactions are restricted only to the devices they own. To enable your users to interact with their devices, you’ll need to create a client session and pass its token to the<SeamProvider />.
1 — Install the Seam SDK on your Server
Seam provides client libraries for many languages such as Javascript, Python, Ruby, and PHP, as well as a Postman collection and OpenAPI spec.- Javascript:
npm i seam(npm, github) - Python:
pip install seam(pip, github) - Ruby:
bundle add seam(rubygem, github) - PHP:
composer require seamapi/seam(packagist, github)
This guide uses a Sandbox Workspace. Only virtual devices can be connected. If
you need to connect a real August Lock, use a non-sandbox workspace and API
key.
2 - Install @seamapi/react in your React application
3 — Create a Seam Client Session on your Server, and pass it to the Client
We’ll start by writing some server code that returns a client session. There are a lot of ways to do this depending on your server framework:- Create an endpoint such as
/api/seam/get_client_sessionand call it from your frontend app. - Inject the client session token in your html if you’re using an HTML templating engine.
For most applications, the
user_identifier_key below should be be your
internal user id. For a detailed explanation, see selecting a user Identifier
key.- Javascript/NextJS API
- Laravel/PHP API
Why do we need the backend for getting the Client Session Token? It allows you
to use your application’s existing authentication! If you want to have Seam
handle all the user authentication, you can use a publishable key, but we
recommend using client session tokens!
4 - Use Your Client Session Token to Display a User’s Devices
Next Steps
- Minimal sample apps running Seam Components in various frameworks.
- View and play with components in the interactive storybook component library
- Check out some Full Example Apps