I have two Box users. Box user A creates a folder and a document within that folder and adds Box user B as a collaborator on the folder.
I then grant access to user B's Box account to my application. The resulting access token is token 1. Using token 1, I can query for the file info for the file that user B is a collaborator on. Notice that the json contains entries in the "path_collection" and the "parent" field is not null:
stephen@stephen:~$ curl https://api.box.com/2.0/files/removed for privacy98 -H "Authorization: Bearer "
{
"type": "file",
"id": "removed for privacy98",
...
"path_collection": {
"total_count": 3,
"entries": [
...
]
},
...
"parent": {
"type": "folder",
"id": "removed for privacy0",
"sequence_id": "0",
"etag": "0",
"name": "Inner"
},
...
}
Now that I have verified that the parent is there, user B proceeds to use some functionality within my application that wants to look up the parent for a given file.
My application uses the Box Java SDK. The first thing that I notice is that the access token gets refreshed. We'll call this new token token 2. The second thing I notice is that my application fails because it couldn't find any parent information in the json it gets back from Box.
Log output from my application:
08:05:07,661 - Get user role for box file removed for privacy98
08:05:07,661 - created boxFile
08:05:07,661 - retrieving fileInfo
08:05:08,277 - Refreshing Box access/refresh token for box user removed for privacy
08:05:08,597 - getParent = NoneNow, I try to do a manual cURL request again for user B with access token 2:
stephen@stephen:~$ curl https://api.box.com/2.0/files/removed for privacy98 -H "Authorization: Bearer "
{
"type": "file",
"id": "removed for privacy98",
...
"path_collection": {
"total_count": 0,
"entries": []
},
...
"parent": null,
...
}Why is the refreshed access token unable to retrieve parent information for the file? Box User B is still a collaborator on the file. Nothing has changed except for the access token. If I re-grant access and generate a completely new access/refresh token pair (we'll call it token 3), this new token 3 is able to get the parent for the file again.
Am I missing something? Are there some scopes that token 1 and 3 have that token 2 does not? Why does letting the Java SDK do its thing and refresh my token break my functionality?