Skip to main content
Question

I can access file using developer code, but not using access code

  • May 22, 2025
  • 1 reply
  • 24 views

Forum|alt.badge.img

hi, I'm pretty new to box so this might be a stupid question.

basically, I'm trying to make an application where I need the API to generate a download URL from a CSV file in my box account so my app can work with the data inside the csv

this is my code

#Authorize User
auth = OAuth2(
client_id='myid',
client_secret='mysecret',
access_token='devtoken/accesscode',
)
client = Client(auth)

user = client.user().get()
print(user)
print('The current user ID is {0}'.format(user.id))

## API GET DOWNLOAD LINK
file_id = 'myid'
url = client.file(file_id).get_download_url()
print('The file\'s download URL is: {0}'.format(url))

so when I used my developer code it's working perfectly as I want, but when I tried to use the access token I get from API it shows error 404, I'm using client credentials grant

i did some research and I found out that it's because the API is being run using service account auto-generated in the apps instead of my account id, I've tried giving the service account collaborator and editor access to my file but it still shows the same error, is there any workaround for this?

1 reply

Forum|alt.badge.img

I'm able to access the files with the grant_type as authorization_code and also with the developer token but im not able to access using client_credentials 

Is authorization access for the app is required? If so who will give that access? Thanks!