Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the application expected to set AutoRefresh to false if they plan to save the connection and restore it after an hour has passed? #223

Closed
cheyrico2 opened this issue Apr 11, 2016 · 1 comment

Comments

@cheyrico2
Copy link

I'm creating an application where I need to save the token to a file and restore it at a later time. after creating the getting the token:

String token = api.save();

I save the token to a file where I expect to be able to restore at later time (greater than 1h):

api2.restore(token);

During the first hour, everything seems fine. Afterwards, I get the following exception:

Exception in thread "main" com.box.sdk.BoxAPIException: The API returned an error code: 400
    at com.box.sdk.BoxAPIResponse.<init>(BoxAPIResponse.java:70)
    at com.box.sdk.BoxJSONResponse.<init>(BoxJSONResponse.java:30)
    at com.box.sdk.BoxAPIRequest.trySend(BoxAPIRequest.java:423)
    at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:209)
    at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:184)
    at com.box.sdk.BoxAPIConnection.refresh(BoxAPIConnection.java:464)
    at test.App.main(App.java:38)

when I try, to use the connection to make a request:

BoxFolder folder = new BoxFolder(api, parentFolderId);
for (BoxItem.Info itemInfo : folder) {
    if (itemInfo instanceof BoxFolder.Info) {
        BoxFolder.Info folderInfo = (BoxFolder.Info) itemInfo;
        resultFolders.add(new BoxPluginFolder(folderInfo.getName(), folderInfo.getID()));
    }
}

I'm not sure what I'm expected to do. I'm not be able to refresh it aftwards.

@cheyrico2 cheyrico2 changed the title Is the developer expected to periodically refresh their token event? Is the application expected to set AutoRefresh to false if they plan to save the connection? Apr 11, 2016
@cheyrico2 cheyrico2 changed the title Is the application expected to set AutoRefresh to false if they plan to save the connection? Is the application expected to set AutoRefresh to false if they plan to save the connection and restore it after an hour has passed? Apr 11, 2016
@cheyrico2
Copy link
Author

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant