Start a new topic
Answered

Diable Oauth option on local push

Hello all, Admittedly this is my first post but I'm having to take key this route to see if there a solution or the potential for this to happen. I would like to be able to initiate simple http/ pushes to the device on local LAN rather than the nessassity to authenticate and negotiate hoops of Oauth. Applications such as Tasker in Android have the ability to post http requests but are stumped as soon as there are any mentions of having header information. If there were the ability for the user to opt in or out for Oauth and the shackles around that I would be a lot happier . Any ideas or suggestions? Not Ifttt. Many thanks.

Best Answer

Hi Sean,


Actually, we found a solution for you :).

There is an external free plugin for Tasker that is able to do more sophisticated requests – RESTask

Here are the options we tried:





Request Type: POST
Host: http://<ip_address>:8080/api/v2/device/notifications
Basic Auth: dev:<api_key>
Enable custom body: yes
Custom body:

{
   "model": {
      "frames": [ {
            "icon": "a2867",
            "text": "Works!"
         }
      ],
      "sound": {
         "category":"notifications",
         "id":"notification2"
      }
   }
}

Headers

Content-Type: application/json

Accept: application/json


Api key for each device can be found here.

IP address of your LaMetric can be found in LaMetric Time app (Wi-Fi settings).


Hope it helps!


Set up a local proxy server that handles the OAuth authentication for you. Your Tasker app would send requests to the proxy server, which would then forward them to the device with the necessary authentication headers.

Problem still exist. It's not clear how to do local push to widget on user device (not developer) with or without authentication

I have to say a big thank you!
Works a dream, definitely worth condensing this and perhaps adding it to the knowledge base?

Thanks again, I'm off to play!
 

 

Answer

Hi Sean,


Actually, we found a solution for you :).

There is an external free plugin for Tasker that is able to do more sophisticated requests – RESTask

Here are the options we tried:





Request Type: POST
Host: http://<ip_address>:8080/api/v2/device/notifications
Basic Auth: dev:<api_key>
Enable custom body: yes
Custom body:

{
   "model": {
      "frames": [ {
            "icon": "a2867",
            "text": "Works!"
         }
      ],
      "sound": {
         "category":"notifications",
         "id":"notification2"
      }
   }
}

Headers

Content-Type: application/json

Accept: application/json


Api key for each device can be found here.

IP address of your LaMetric can be found in LaMetric Time app (Wi-Fi settings).


Hope it helps!


1 person likes this
Hello LaMetric Support,

Appreciate the response. Currently Tasker can not modify/ add header information it only supports body, is there still a method that I can get this to work?

Many thanks.

 

Hi Sean,

Please see LaMetric Developer Documentation to find following information:

To skip OAuth2 authorization you can find API Key here.

And if Tasker can add headers, you can set authorization data manually.

Login or Signup to post a comment