How to get Cloud Endpoint

Depends on how you want to use it... display it in the app configuration, write it to the logs and copy it from there, post it to another local server, etc.

Here's an example rendering it out into an app preference (configuration) as a paragraph:

preferences(){
    page(name: "setupScreen")
}
def setupScreen(){
   if(!state.accessToken){	
       createAccessToken() //be sure to enable OAuth in the app settings or this call will fail
   }
   def localUri = getFullLocalApiServerUrl("optional/path") + "/?access_token=${state.accessToken}"
   return dynamicPage(name: "setupScreen", uninstall: true, install: true){
      section(){ 
         paragraph("Use the following URI to access the endpoint:<br />Local: <a href='${localUri}'>Local URL</a>")
      }
   }
}
2 Likes

Thank you!

@chuck.schwer I am attempting to port the life360 st app over to hubitat. Was having trouble with oauth and finally see what the issue is I think.

When we authorize against life360 and it hits the redirect url in the format above it adds its token the url with ?access_token=token.

Hubitat seems to take this second token and rejects it with an error page. If I copy the correct token in place the app then authorizes.

So my question is there any other format I can use for the redirect url that will get around this.

I cannot edit the life360 side of things at all.

Currently on my phone. If you need more information or if the question is not clear let me know!!!

Not that i know of. It appears that ST implemented another way of doing it, so I can add that on to our feature request list.

1 Like

Mm too bad. Thanks as always @chuck.schwer

from what I can see the only real diff is how the access token is passed.

smartthings.

serverUrl + "/api/token/${state.accessToken}/smartapps/installations/${app.id}/receiveToken

hubitat

"${getApiServerUrl()}/${hubUID}/apps/${app.id}/receiveToken?access_token=${state.accessToken}"

Just curious - why are you porting the ST Life360 to HE when there is already native Life360 support built into Hubitat?

See this thread

So after much banging my head against the wall I went the password auth route and all is well.

From what I read this is a how parameters are read from the url. When a key is passed more than once the second key:value pairs overwrite the first. So Hubitat doesnt accept the call. I then cannot save the access token trying to be passed in.

So just a quick question to @chuck.schwer can an alternate key name easily be added so we can pass the access token with a different key?

I am thinking this is a very edge case. However it drove me nuts for a few days.