Im trying to get QAuth2.0 with Server JWT authorized to connect my app to Enterprise account in Box.
This is my code:
auth = JWTAuth(
client_id='*******************',
client_secret='*************************',
enterprise_id='*****',
jwt_key_id='********',
rsa_private_key_file_sys_path='/Users/*****/python_alert/private.pem',
rsa_private_key_passphrase='****',
store_tokens=None,
)
access_token = auth.authenticate_instance()
client = Client(auth)
This is the error I get:
No handlers could be found for logger "boxsdk.network.default_network"
Traceback (most recent call last):
File "box.py", line 33, in
access_token = auth.authenticate_instance()
File "/Library/Python/2.7/site-packages/boxsdk/auth/jwt_auth.py", line 384, in authenticate_instance
return self._auth_with_jwt(self._enterprise_id, 'enterprise')
File "/Library/Python/2.7/site-packages/boxsdk/auth/jwt_auth.py", line 243, in _auth_with_jwt
return self._construct_and_send_jwt_auth(sub, sub_type)
File "/Library/Python/2.7/site-packages/boxsdk/auth/jwt_auth.py", line 219, in _construct_and_send_jwt_auth
return self.send_token_request(data, access_token=None, expect_refresh_token=False)[0]
File "/Library/Python/2.7/site-packages/boxsdk/auth/oauth2.py", line 401, in send_token_request
token_response = self._execute_token_request(data, access_token, expect_refresh_token)
File "/Library/Python/2.7/site-packages/boxsdk/auth/oauth2.py", line 347, in _execute_token_request
six.raise_from(self._oauth_exception(box_api_excpetion.network_response, url), box_api_excpetion)
File "/Library/Python/2.7/site-packages/six.py", line 737, in raise_from
raise value
boxsdk.exception.BoxOAuthException:
Message: None
Status: 400
URL: https://api.box.com/oauth2/token
Method: POST
Headers: {'Content-Length': '145', 'Content-Encoding': 'gzip', 'Set-Cookie': 'box_visitor_id=5c1a9937dd6033.60743312; expires=Thu, 19-Dec-2019 19:17:11 GMT; Max-Age=31536000; path=/; domain=.box.com; secure, bv=OPS-42764; expires=Wed, 26-Dec-2018 19:17:11 GMT; Max-Age=604800; path=/; domain=.app.box.com; secure, cn=66; expires=Thu, 19-Dec-2019 19:17:11 GMT; Max-Age=31536000; path=/; domain=.app.box.com; secure, site_preference=desktop; path=/; domain=.box.com; secure', 'Age': '1', 'Strict-Transport-Security': 'max-age=31536000', 'Vary': 'Accept-Encoding', 'Connection': 'keep-alive', 'Cache-Control': 'no-store', 'Date': 'Wed, 19 Dec 2018 19:17:12 GMT', 'Content-Type': 'application/json'}
My enterprise admin has authorized my app as well. Can someone help please?