Fail to search folder info on my box app through Python BoxSDK(JWTAuth) token
AnsweredI have created an box application successfully using my developer account.
1.When I used developer token generated on box app UI, I am able to search folder infos on my app
GET https://api.box.com/2.0/folders/0/items
"total_count": 5,
"entries": [
{
"type": "folder",
"id": "6***phone number removed for privacy***",
"sequence_id": "1",
"etag": "1",
"name": "Test1"
},
{
"type": "folder",
"id": "6***phone number removed for privacy***",
"sequence_id": "0",
"etag": "0",
"name": "Test2"
……
2. When I used token generated via python boxsdk, it returned 0 items with 200 OK.
I can create a folder and search it using this token successfully, but it didn`t appear on my app as well.
My code is here :
from boxsdk import JWTAuth auth = JWTAuth( client_id='*******', client_secret='********', enterprise_id='*****', jwt_key_id='******', rsa_private_key_data='*******', rsa_private_key_passphrase='**********' ) access_token = auth.authenticate_instance()
I set ‘jwt_key_id’ to ‘Public key 1 ID’ in configuration, other parameters are consistent with app config as well.
I also tried to create an application user via client, however, it returned an error message: “The request requires higher privileges than provided by the access token” .
I am not sure whether this issue is due to my app configuration.
My app configuration:
Authentication Method (OAuth 2.0 with JWT)
Thanks in advance.
-
Hi lingjshi,
When you generate a developer token in the Dev Console, it generates a token for your personal box account that you created the application under. So, if you have this content in your personal account, it would surface in a search using the developer token for your personal account.
When you generate a token using the Python SDK, it generate's a token for your application's Service Account within the Box Enterprise - not your personal account. If you upload content to the Service Account through the API, it will be searchable using the token returned from the Python SDK.
Hope this helps!
-
Hi mbehn,
Thank you for your advice.
I followed Service Account , added my service account as a collaborator, it is working well with token generated via Python BoxSDK.
Please sign in to leave a comment.
Comments
2 comments