while the auth0-python implementation expects str (referring to 4.7.1 code snippet: [link]
(method reference: auth0.management.users.Users.remove_permissions and auth0.management.users.Users.add_permissions)
Reproduction
Using a CPython 3.12.3 venv with auth0-python 4.7.1
>>> from auth0.management.auth0 import Auth0
>>> auth0_ = Auth0(
... domain="MY_DOMAIN",
... token="MY_TOKEN",
... )
>>> auth0_.users.add_permissions(id="USER_ID", permissions=["EXISTING_PERMISSION_NAME"])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/project/.venv/lib/python3.12/site-packages/auth0/management/users.py", line 309, in add_permissions
return self.client.post(url, data=body)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/project/.venv/lib/python3.12/site-packages/auth0/rest.py", line 207, in post
return self._request("POST", url, json=data, headers=request_headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/project/.venv/lib/python3.12/site-packages/auth0/rest.py", line 187, in _request
return self._process_response(response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/project/.venv/lib/python3.12/site-packages/auth0/rest.py", line 258, in _process_response
return self._parse(response).content()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/user/project/.venv/lib/python3.12/site-packages/auth0/rest.py", line 294, in content
raise Auth0Error(
auth0.exceptions.Auth0Error: 400: Payload validation error: 'Expected type object but found type string' on property permissions[0].
>>>
Checklist
Description
Checking the API docs from
Auth0 Management API v2 > Users > Assign permissions to a user
[link], andAuth0 Management API v2 > Users > Remove permissions from a user
[link]we can verify that a permission is represented by a
dict
with two values:while the
auth0-python
implementation expectsstr
(referring to 4.7.1 code snippet: [link](method reference:
auth0.management.users.Users.remove_permissions
andauth0.management.users.Users.add_permissions
)Reproduction
Using a CPython 3.12.3 venv with
auth0-python
4.7.1Additional context
No response
auth0-python version
4.7.1
Python version
3.12.3