Я пытаюсь получить OAuth2.0
с сервером JWT, авторизованным для подключения моего приложения к корпоративной учетной записи в Box.
Это мой код:
auth = JWTAuth(
client_id='*******************',
client_secret='*************************',
enterprise_id='*****',
jwt_key_id='********',
rsa_private_key_file_sys_path='/Users/*****/python_alert/private.pem',
store_tokens=None,
)
access_token = auth.authenticate_instance()
client = Client(auth)
Это ошибка, которую я получаю:
Traceback (most recent call last):
File "box.py", line 48, 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': '96', 'Set-Cookie': 'box_visitor_id=5c1ac196645615.80056514; expires=Thu, 19-Dec-2019 22:09:26 GMT; Max-Age=31536000; path=/; domain=.box.com; secure, bv=OPS-42766; expires=Wed, 26-Dec-2018 22:09:26 GMT; Max-Age=604800; path=/; domain=.app.box.com; secure, cn=82; expires=Thu, 19-Dec-2019 22:09:26 GMT; Max-Age=31536000; path=/; domain=.app.box.com; secure, site_preference=desktop; path=/; domain=.box.com; secure', 'Age': '0', 'Strict-Transport-Security': 'max-age=31536000', 'Connection': 'keep-alive', 'Cache-Control': 'no-store', 'Date': 'Wed, 19 Dec 2018 22:09:26 GMT', 'Content-Type': 'application/json'}
BTW,администратор моего предприятия также авторизовал мое приложение.Может кто-нибудь помочь, пожалуйста?