Possible to have multiple instances of an app running on the same location?


(James Fitzgerald) #1

Hey all - I’m creating a smartapp and would like to have multiple instances of my smartapp running at a single location, i.e. one installation instance to control one set of locks and switches, and another installation instance to control another set of locks and switches. The app has a set of endpoints and is OAuth enabled.
When I go through the OAuth flow, I’m getting back the same authorization token and installation ID. Is there any way to install a new instance every time I go through the flow, selecting different devices?


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

I don’t think there is a way. Since the SmartApp is only identified in the OAuth process by its client_id and client_secret to establish installation and authorization, there is subsequently only one additional variable that creates an “instance” … i.e., the Location ID; which is used to generate the Endpoint and Access Token combination.

It is possible that there is an hidden (undocumented?) extra option to the /authorize REST call. If you get sufficient readership of this Topic, someone might know for sure. … @Jim?

But OAuth can be established through any SmartApp by simply generating an access token within the SmartApp itself (ummm… not so sure about the unique endpoint ID though…). In this manner, a parent-child SmartApp could be used? Or just OAuth to get the endpoint of a parent SmartApp and have it pass through to children? I’m just spitballing.

http://docs.smartthings.com/en/latest/smartapp-developers-guide/parent-child-smartapps.html#preventing-more-than-one-parent-instance