Restricting Cloud Access to App Endpoint

I've created an app with a endpoint (enabled oauth, created access tokens, mappings and handlers). However, I want to restrict it to LAN only.

Is this something that I handle in the handler and if so what would the logic look for to determine if the call was local or from the cloud? Or is there another setting to disable cloud access altogether?

I'm trying to implement a setting similar to whats in Maker API.

Got it. Just dropping it here if anybody else runs into this.

In the handler, request.requestSource is either 'cloud' or 'local'.

Can use this in the logic.


Thank you!! How in the world did you find that? Very nice!! I was wondering the exact same thing for a while so I'd bookmarked your topic. :smiley: so at least one other person was definitely wondering the answer. Thank you!!!!

I still frequent smartthings documentation when needed. Found a clue here and once I dumped the response object to the logs it showed me what I wanted.

And there were a bunch of other nice to knows in here in giving responses.

1 Like

That's so funny...I started reading through that just a couple days ago but was late so I had to bookmark it to come back to it. :slight_smile: Personally, I think Hubitat's method for Oauth is SOOO much easier though. And very different from ST. So, be weary of what you read on that one if it's for Hubitat. You token can be obtained much easier.

1 Like

Ya. I usually search the HE forums. Look at HE code and check the HE documentation. But every now and then I have to go back to the ST documentation because it feels like I’m one of the few wanting to know this.

I’ve pretty much rewrote every app and driver I use. I strip out all the useless stuff, make some of the code more efficient and get to know it inside out. Gives me a deep understanding of everything going on with my hub.

I've been doing the same. I'm slowly getting rid of all my stock apps. Even rule machine. I've been re-writing them directly in groovy. It really is a game changer. You have 100% control over everything. Plus, the speed is amazing. Take a look at this:

From the sensor going active to the entire app finishing processing is less than 110ms. Not the app starting...the app finishing. That's crazy fast!!! But all my apps are only useful in my house with my set of devices and my situation. The UI is only used to select devices and other inputs. Everything else is hard coded. But because of that, the app is super lean. No overhead at all.

1 Like

Exactly! I've been telling people for a while now the benefits of learning groovy. Once you learn groovy it becomes your rule machine (and even webcore) replacement.

The feature bloat on a lot of these apps just slows things down and it builds up as you add more apps.

This is why I like this hub so much.

1 Like

Couldn’t agree with y’all more... Been working on replacing everything with my own apps too... Soooooo much faster...