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

Reply via email to