Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fbx.system.reboot() ==> freepybox.exceptions.HttpRequestError: insufficient_rights #7

Open
lboue opened this issue Dec 15, 2018 · 3 comments

Comments

@lboue
Copy link
Contributor

lboue commented Dec 15, 2018

Hello, I am trying to reboot my FreeboxV6 why this command:
fbx.system.reboot()

And I am getting the following error: insufficient_rights.

Details:

pi@raspberrypi:~/freepybox $ python3 freeboxV6-reboot.py 
Traceback (most recent call last):
  File "freeboxV6-reboot.py", line 23, in <module>
    fbx.system.reboot()
  File "/home/pi/freepybox/freepybox/api/system.py", line 18, in reboot
    self._access.post('system/reboot')
  File "/home/pi/freepybox/freepybox/access.py", line 39, in post
    raise HttpRequestError(resp['error_code'])
freepybox.exceptions.HttpRequestError: insufficient_rights

It seems that requested rights allowed to this app are not sufficient for reboot.
I had to edit freebox application permission to allow 'edit Freebox settings':

modif_droits_appli_reboot

Could you help me to fix that please?

Regards,

@lboue lboue changed the title freepybox.exceptions.HttpRequestError: insufficient_rights fbx.system.reboot() ==> freepybox.exceptions.HttpRequestError: insufficient_rights Dec 15, 2018
@lboue
Copy link
Contributor Author

lboue commented Dec 15, 2018

To help, here is the v6 API response for an authorization method call:

{
   "success":true,
   "result":[
      {
         "app_name":"Freebox Compagnon",
         "id":1,
         "app_version":"42",
         "device_name":"Phone",
         "last_session":1544811452,
         "req_ip":"192.168.1.101",
         "req_date":1543006529,
         "permissions":{
            "contacts":true,
            "downloader":true,
            "parental":false,
            "calls":true,
            "explorer":true,
            "pvr":true,
            "tv":true,
            "settings":true
         },
         "app_id":"fr.freebox.compagnon",
         "token_validity":"granted"
      },
      {
         "app_name":"freepybox",
         "id":6,
         "app_version":"",
         "device_name":"raspberrypi",
         "last_session":1544641640,
         "req_ip":"192.168.1.100",
         "req_date":1544905277,
         "permissions":{
            "parental":false,
            "explorer":true,
            "contacts":true,
            "tv":true,
            "downloader":true,
            "settings":false,
            "calls":true,
            "camera":false,
            "pvr":true,
            "home":false,
            "player":false
         },
         "app_id":"fpbx",
         "token_validity":"granted"
      }
   ]
}

Regards,

@stilllman
Copy link
Contributor

I had the same issue when trying to switch wifi on/off ; I looked in the sdk documentation, but from what I can tell, there is no way to specify a list of requested rights when registering an application, so I'm not sure there is a solution to this issue.

@lboue
Copy link
Contributor Author

lboue commented Dec 16, 2018

I dont' have the v6 API documentation but I think it can work as following:

  1. Ask for 'administrator' password
  2. Get the account list api/v6/authorization and find the id for the "app_name":"freepybox"
  3. Change privileges for the with the authorization method PUT /api/v6/authorization/6

I think the are doing that for the official "Freebox" mobile app.

img_1349

Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants