On Mon, Apr 11, 2022 at 5:25 PM Reto Peter <reto.pe...@advanceit.ch> wrote: > > Hi Claus > > It looks like that dropbox will now only issue short-lived access tokens and > working with additional refresh tokens. > From dropbox doc: > On September 30th, 2021, Dropbox will retire the creation of long-lived > access tokens. Apps that require background (“offline”) access but have not > yet implemented refresh tokens will be impacted. > Implement refresh tokens: For apps that "Want to interact with the Dropbox > API when a user isn’t actively interacting with the app (“offline” access)", > we offer a long-lived refresh_token that can be used to request a new, > short-lived access token. > > I think there must be an adjustment in the API Camel is using. >
Yeah you are right, and welcome to create a JIRA ticket about this > Reto > > -----Original Message----- > From: Claus Ibsen <claus.ib...@gmail.com> > Sent: Monday, April 11, 2022 7:35 PM > To: users@camel.apache.org > Subject: Re: DropBox expired_token > > Hi > > Ah is that because your token is some kind of developer token that is short > lived? > Or do you know if its standard at DropBox to have tokens limited to 4 hours? > > If its so short lived, then we should look at a way for Camel to be able to > automatic extend the token expiry, fetch a updated token, or what means > DropBox supports. > > > On Mon, Apr 11, 2022 at 8:14 AM Reto Peter <reto.pe...@advanceit.ch> wrote: > > > > Hi > > > > I have successfully used the dropbox component for download, upload and > > delete files. > > You can see my implementation below, cause there was some important > > issues to solve before it worked > > > > Actually the only problem I have is the expired_token. The generated token > > (which I created in the app console) does always expire after 4 hours and > > then I get the error message from the component: > > InvalidAccessTokenException: {"error_summary": > > "expired_access_token/...", "error": {".tag": "expired_access_token"}} > > > > I read about other SDK which access the dropbox API, that the API does > > handle to refresh the access_token if its expired. > > What is my mistake? Is there a way to generate a permament access_token in > > dropbox itself or how? > > > > Here is my route for DOWNLOAD: > > from("timer://simpleTimer?period=10000") > > .to("dropbox://get?accessToken={{dropbox.accessToken}}" > > + "&clientIdentifier={{drobbox.clientIdentifier}}" > > + "&remotePath=/from_cellular") > > .log("Dropbox download 'from Cellular': Check if there are files > > available from Cellular in DropBox CellularEDI") > > .choice() > > .when(simple("${header:DOWNLOADED_FILES} == ''")) > > .log("Dropbox download: No files available") > > .when(simple("${header:DOWNLOADED_FILES} == null && > > ${header:DOWNLOADED_FILE} != ''")) > > .log("Dropbox download: 1 file available: > > '${header:DOWNLOADED_FILE}'") > > > > .to("file:{{dir.from.cellular}}?fileName=${header:DOWNLOADED_FILE}") > > .toD("dropbox://del?accessToken={{dropbox.accessToken}}" > > + > > "&clientIdentifier={{drobbox.clientIdentifier}}" > > + "&remotePath=${header:DOWNLOADED_FILE}") > > .when(simple("${header:DOWNLOADED_FILES} != '' && > > ${header:DOWNLOADED_FILE} == null")) > > .log("Dropbox download: Several files available: > > '${header:DOWNLOADED_FILES}'") > > .split(simple("${in.body.entrySet}")) > > .setHeader("DropBoxFileName", simple("${body.getKey}")) > > .setBody(simple("${body.getValue}")) > > .log("Dropbox download: Save file: > > ${header.DropBoxFileName}") > > > > .to("file:{{dir.from.cellular}}?fileName=${header.DropBoxFileName}") > > .toD("dropbox://del?accessToken={{dropbox.accessToken}}" > > + > > "&clientIdentifier={{drobbox.clientIdentifier}}" > > + "&remotePath=${header.DropBoxFileName}"); > > > > Here is my route for UPLOAD: > > from("file:{{dir.to.cellular}}?preMove=.inprogress&move=.done&delay=1000") > > .log("Dropbox upoad: Trying to upload file ${file:name} to DropBox > > CellularEDI") > > .setHeader(DropboxConstants.HEADER_PUT_FILE_NAME, > > simple("${file:name}")) > > .to("dropbox://put?accessToken={{dropbox.accessToken}}" > > + "&clientIdentifier={{drobbox.clientIdentifier}}" > > + "&uploadMode=force" > > + "&remotePath=/to_cellular/") > > // The upload does not work if I don't put the last '/' > > .choice() > > .when(simple("${body} == 'OK'")) > > .log("Dropbox upload success: File ${file:name} was uploaded > > to DropBox folder: ${header:UPLOADED_FILE}") > > .otherwise() > > .log("Dropbox upload FAILED: File ${file:name} Failed > > with result: ${body}"); > > > > > > Environment: > > Camel 3.16.0 > > SpringBoot 2.6.4 > > Java 11 > > > > Reto > > > > -- > Claus Ibsen > ----------------- > http://davsclaus.com @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2 -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2