This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Remote service without basic auth
#1
I am trying to use Remote services with an LM with 20240426 firmware but since there is no more basic auth, it does not work and always asks to login (if I use get request through browser). Is there a solution? Do I need to add some body to the request maybe?
Reply
#2
Working example using Fetch API:

Code:
async function send() {
  var url = 'http://192.168.0.9/scada-remote?m=json&r=grp&fn=write&alias=0/0/1&value=1'
  var user = 'remote'
  var pass = 'Remote123'
  var headers = new Headers()

  headers.append('Authorization', 'Basic ' + btoa(`${user}:${pass}`))

  var res = await fetch(url, { method: 'GET', headers: headers })

  console.log(res)
}
Reply
#3
Ok, that could be a problem since I am trying to exchange info with Yealink phones, which can not make requests with headers. Is there a way I can make API calls without a header?
Reply
#4
You can create a .lp script instead: https://kb.logicmachine.net/misc/apps/#lp-scripts
It does not require authentication if placed in the public directory.
Reply
#5
(29.07.2024, 06:25)admin Wrote: You can create a .lp script instead: https://kb.logicmachine.net/misc/apps/#lp-scripts
It does not require authentication if placed in the public directory.

Interesting, could you give me an example of a script like this?
Reply
#6
Check this: https://forum.logicmachine.net/showthrea...7#pid20407
The example above can be placed in user directory so only authorized users can access it.
Reply


Forum Jump: