Cannot get a simple file download to work through box..api with curl
AnsweredI have run into 2 issues with my Custom App
Auth Method: OAuth 2.0 with Client Credentials Grant (Server Authentication)
App Access Level: App+Enterprise Access
Client id: ssunxw71at2t90vqe0m0goaj3ya6ol7h
1. Cannot get token associated with the user id
Error message: {"error":"invalid_grant","error_description":"Grant credentials are invalid"}
Then I changed to authenticate through enterprise id, replacing the last two lines with
e":"Not Found","request_id":"f07bwyh5z1f62o2o"}
e":"Could not find the specified resource","request_id":"fwrqlyh5z21n3ztv"}
-
Hi
1. Most likely you need to ensure that your app has the 'generate user access tokens' advanced feature turned on (and re-authorize after you make the change)
2. Most likely the application service account does not have access to the folder you are trying to fetch. When you use the 'enterprise' subject in client credentials grant you will get a token for the service account. You can check this by running this API https://developer.box.com/reference/get-users-me/ which returns the current user. You can the copy the login from the output (should be 'AutomationUser....@boxdevedition.com') and share the folder using your logged in Box account. Then the API should return the folder.
Hope this helps
Rgds,
Peter Christensen, Platform Solutions Engineer, Box -
Hi Peter,
Thanks for the prompt response. It works now after I checked the two boxes under "Advanced" as you suggested in solution 1: I was able to get the token as a user, then using the token to get folder and file.
I think it'd be nice if the documentation gives some clear explanation on what those options would enable. Various bits of info seem to scatter in different urls, making it hard to understand what each of those options would entail. Thankfully we have a support forum with quick responses, which is much appreciated.
-
By the way, there is another issue: the email for re-authorization after changing config seems to have stopped working. I tried multiple times and waited and never receive the email to authorize the change. I had to create a new app. I actually had the old app working a couple of months ago but with the new app I forgot which bit of config change was critical. With a simple download not working, combined with the authorization email not arriving, I was suspecting something was broken on box.com. Thus the question.
Post is closed for comments.
Comments
4 comments