SmartApp gives same token for different locations

I have two hubs under my account, labelled as different locations. I created a web services SmartApp and want to apply it to both locations. Token is necessary for my SmartApp and is acquired by Oauth2 process. So far so good. However, when I use oauth to get token for two different locations (two different hubs), I found out the token is exactly the same even though I selected different devices and location. That means I can only have one active token and cannot apply the SmartApp to different location. Can anybody please explain to me what should I do?

More detail:

  • My SmartApp has not published for all yet, only published for me to test
  • Two hubs in two different locations but under the same account, with different devices (I moved some devices from one hub to another hub one time)

Each separate instance of any SmartApp (in the same Location or multiple Locations) should have a unique Installation ID. This is returned as a part of the URI during the OAuth process. The Client ID and Auth Token are the same because they are from your same SmartThings Account. The Unique URIs ensure you can talk to the distinct Location.

or During testing, perhaps you could manually install the SmartApp in each Location?

Thank you very much for your pointer. That helps a lot to a green hand like me. It turns out that I have multiple same apps installed at the same location (no idea how I that happens), that messes things up here.

I obtained the unique installation ID through the get endpoint request as shown in "BASE-URL/api/smartapps/installations/INSTALLATION-ID". This happens after I acquired the access_token. If the access token is the same for the same account even for different location, it looks like SmartThings knows which installation-id to return back to me by also referring to the location information.

2 Likes