Error 403 Access denied - insufficient permission with API as user
I am using the python sdk to try to automate uploading a large batch of files to Box. I have created an app in the developer console and authorized my script with the JWT authorization. I want to upload files directly to a folder in my box drive so I tried to use the as-user heading as it is described in the docs. I have authorized my app as the enterprise admin, and I have checked to make sure the app has permission to edit files and make calls as the user. I am still getting the error.
Here is the authorization code I used:
from boxsdk import Client, JWTAuth
auth = JWTAuth.from_settings_file('config.json')
client = Client(auth)
current_user = client.user().get()
user_to_impersonate = client.user(str(current_user.id))
user_client = client.as_user(user_to_impersonate)
user_client.folder("0").get() #this creates the error
BoxAPIException: Message: Access denied - insufficient permission Status: 403 Code: access_denied_insufficient_permissions Request ID: erx3qrh6t3wjj52i
-
Hello,
It looks like you are doing something incorrectly in the code. It looks like you are trying to make an as-user client with the same user as the service account. the str(current_user.id) should be the user you are wanting to impersonate... does that make sense?
Alex, Box Developer Advocate
Alex, Box Developer Advocate
Post is closed for comments.
Comments
1 comment