Can't terminate web-hosted app

So I'm building an web-hosted app with react for WebOS. I need to terminate the app after the user clicks on a specific button. But the problem is I can't manage to close the application by making a request call to the applicationManager. Everytime I try to I get an denied response.

Here's how I'm trying to terminate it:

webOS.service.request('luna://com.webos.applicationManager', {
    method: 'closeByAppId',
    parameters: { id: TV_APP_ID },
    onSuccess(response) {
      if (response.returnValue === false) {
        console.error(
          `Error sending Application to background and bringing TV Application with ID ${TV_APP_ID} to the foreground.`
        );
      }
      console.log('success');
    },
    onFailure(error) {
        alert(error)
        console.log(error)
    },
  })

and the response I always get it:

{returnValue: false, errorCode: -1, errorText: "Denied method call "closeByAppId" for category "/dev""}

Does anyone know where am I messing things here?

Hi @raymag , welcome to the forum.

What is your webOS platform? TV or OSE?
This forum only for webOS Open Source Edition.
For webOS TV, please visit the TV Forum.

Thanks