Implementing Client Sessions for Device Management in the Backend
Learn how to use client sessions to control your users' access to devices.
Connect Your Users' Accounts Using a Client Session
// Pass your API key to the Seam constructor to authorize access
// to your Seam workspace.
// Set your API key. Remember to switch to your live API key
// in production.
const seam = new Seam("YOUR_API_KEY")
// Get or create a client session using your own internal user
// ID as the user_identifier_key.
const user_identifier_key = "xxxx"
const client_session = await seam.clientSessions.get_or_create({
user_identifier_key
})
// Create a Connect Webview and link the Connect Webview to the
// client session, using the user_identifier_key to identify the
// desired client session.
const connect_webview = await seam.connectWebviews.create()
await seam.clientSessions.grant_access({
user_identifier_key,
connect_webview_ids: [connect_webview.connect_webview_id],
})
// Share the URL of the Connect Webview with the user to enable
// them connect their devices.
const connect_webview_url = connect_webview.urlFilter for a User's Devices with the User Identifier Key
Authorize Requests Using the User Identifier Key
Last updated
Was this helpful?

