I run a small personal dashboard on my own computer that controls my own Samsung refrigerator through the SmartThings API. Personal access tokens now expire after 24 hours, so the dashboard stops working every day. The recommended fix is an OAuth-In app (authorization code flow with refresh tokens), but I cannot create one. What I tried: (1) smartthings apps:create with an API_ONLY app JSON that includes an oauth section, (2) smartthings apps --json, (3) GET https://api.smartthings.com/v1/apps with a personal access token that has r:apps:, w:apps:, r:smartapps: and w:smartapps:. All three return 403 Forbidden, while the same login works fine for locations and devices. Are there prerequisites I am missing (developer mode, Developer Workspace registration, a hub, a certain account type or region), or is app creation restricted for some accounts? And what is the supported way to keep a local script working past 24 hours? Thanks.
You need a subscription starting yesterday.
You need two things.
- To subscribe to a £4.99 (UK) per month development plan in the SmartThings Console to allow you to create an API_ONLY app (they now use the API Access branding outside the API).
- To download a new version of the CLI which replaces ‘apps’ with ‘smartapps’. Similarly the API /apps endpoint has been withdrawn in favour of the /smartapps endpoint.
Unfortunately the Webhook SmartApps that would hitherto have been an alternative solution are also now deprecated and the API no longer supports creating them.
Yes, it sucks. I think perhaps we are supposed to delight in all the apps we get for free in the mobile app to implement someone else’s solutions to someone else’s problems, instead of creating our own solutions to our own problems.