How to get accessToken and pick a live path
How to get accessToken and pick a live path
Direct Answer
Start with an AppId on Imou Open Platform, obtain **accessToken on your server**, sync devices, then pick a live path: **getKitToken + ImouPlayer** for interactive web, or **bindDeviceLive** for HLS. kitToken ≠ accessToken. Never put appSecret or accessToken in the browser.
Three-step mainline
- AppId →
accessTokenRegister at open.imoulife.com, create an application, storeappSecretserver-side, and call[accessToken](https://open.imoulife.com/book/http/accessToken.html)from your BFF. Cache and refresh according to platform guidance. - Bind & list devices Bind cameras to the developer asset pool. Sync inventory with
[listDeviceDetailsByPage](https://open.imoulife.com/book/http/device/manage/query/listDeviceDetailsByPage.html)(pageSize1–50). Map devices into your own tenant/site model and authorize end users in your product before any play request. - Pick a live path and mint on demand After ACL pass, open streams only when the user watches:
- Web controls →
[getKitToken](https://open.imoulife.com/book/js/sdk.html)+ ImouPlayer (kitToken~2h; cache ~1h on BFF) - HLS URL →
[bindDeviceLive](https://open.imoulife.com/book/http/device/live/bindDeviceLive.html) - RTMP →
[createDeviceRtmpLive](https://open.imoulife.com/book/http/device/live/createDeviceRtmpLive.html) - Native → OpenSDK
Prefer SD (streamId = 1) for multi-tile views; HD (streamId = 0) for focus. Destroy players when tiles close. Check live-view resources under My Resources.
AppId + appSecret (server)
→ accessToken (BFF)
→ listDeviceDetailsByPage (ledger)
→ ACL check (your SaaS)
→ getKitToken / bindDeviceLive / OpenSDK (on demand)
When to choose which live path
| Surface | Path |
|---|---|
| Interactive web / H5 monitoring | getKitToken + ImouPlayer |
| Custom player or gated HLS share | bindDeviceLive |
| Existing RTMP media pipeline | createDeviceRtmpLive |
| Android / iOS app | OpenSDK |
Talk, PTZ, and cloud playback depend on device model and subscribed services—enable UI only when those capabilities exist. For multi-camera walls, sync inventory first and open slots on demand; do not prefetch every HD stream at login.
Token reminders
| Credential | Where it lives | Role |
|---|---|---|
appSecret | Server / secrets manager only | Proves your developer app |
accessToken | BFF cache only | Authenticates OpenAPI calls |
kitToken | Returned to browser after ACL | ImouPlayer play credential (~2h; cache ~1h) |
| HLS / RTMP URL | Returned to client after ACL | Treat as a shareable secret; gate and rotate |
A common first-day failure is initializing ImouPlayer with accessToken. The player expects kitToken. Another is embedding secrets in the SPA “to move faster”—that skips your tenant ACL and creates a permanent incident class.
