Hi, @ajankowski @lsocha, @rbarbosa
I use a client credentials grant for accessing my enterprise account. I successfully called the enterprise user API using the boxsdk for python. But now when I try to call any box API using the client I get the following error.
DEBUG 2023-11-24 04:13:25,474 oauth2 Refreshing tokens. (oauth2.py:214)
INFO 2023-11-24 04:13:52,500 default_network e[36mPOST https://api.box.com/oauth2/token {'data': {'box_subject_id': '30187662834',
'box_subject_type': 'user',
'client_id': '---9or2',
'client_secret': '---nKID',
'grant_type': 'client_credentials'},
'headers': {'User-Agent': 'box-python-sdk-3.9.2',
'X-Box-UA': 'agent=box-python-sdk/3.9.2; env=python/3.10.12',
'content-type': 'application/x-www-form-urlencoded'}}e[0m (default_network.py:79)
I debugged and found that the refresh call is made inside the oauth2.py file in the boxsdk.
right when this code is called under the
refresh()
access_token, refresh_token = self._refresh(access_token_to_refresh)
the exception occurs.
following are the debug terminal log
(Pdb) n
boxsdk.exception.BoxOAuthException:
Message: Grant credentials are invalid
Status: 400
URL: https://api.box.com/oauth2/token
Method: POST
Headers: {'Date': 'Fri, 24 Nov 2023 04:13:53 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Strict-Transport-Security': 'max-age=31536000', 'Set-Cookie': 'box_visitor_id=656023014569d9.46726692; expires=Sun, 24-Nov-2024 04:13:53 GMT; Max-Age=31622400; path=/; domain=.box.com; secure; SameSite=None, bv=EUG-5666; expires=Fri, 01-Dec-2023 04:13:53 GMT; Max-Age=604800; path=/; domain=.app.box.com; secure, cn=56; expires=Sun, 24-Nov-2024 04:13:53 GMT; Max-Age=31622400; path=/; domain=.app.box.com; secure, site_preference=desktop; path=/; domain=.box.com; secure', 'Cache-Control': 'no-store', 'Via': '1.1 google', 'Alt-Svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000'}
> /home/midhun.benny/.local/lib/python3.10/site-packages/boxsdk/auth/oauth2.py(222)refresh()