cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Tell us what you want to see on the Community here!
Close

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Invalid Async Job Id fails if Access Token is Refresshed

Highlighted

Invalid Async Job Id fails if Access Token is Refresshed

Helpful | Level 6

I've been doing some work with the batch APIs and came across this error message invalid_async_job_id. 

I've only come across this error when I've had to refresh my token. I send my request to create a folder batch. I get my my job id : dbjid:AAApl4cr-f5ZVygtd8uOfADUlX1ztpq6R8vHe44N5wluGqoSRmIR-LuwCFW4hwKXQggXsdVm6GmXZz_Fa7f4Lhgc

I make a request to createfolderbatchcheck with the job is, it fails intially with expired_access_token. I get a new token and  make another request to createfolderbatchcheck with my job id and new token and get the above error.

No folders get created either, I would of thought by having a job id these would of been created regardless of checking the status of the job

Do i need to do anything else?

Thanks

1 Accepted Solution

Accepted Solutions
Highlighted

Re: Invalid Async Job Id fails if Access Token is Refresshed

Dropboxer

Without more information, I can't say exactly why your folders may not have been created. There are a number of ways for a create_folder_batch job to fail, resulting in the folders not being created. Please refer to the error documentation for the /2/files/create_folder_batch and /2/files/create_folder_batch/check endpoints for information on what errors can occur

Please do try starting the job again with a new access token and check the result within the four hours that the access token is valid. (Or, use a long-lived access token instead.) If API isn't behaving as expected, e.g., if the job fails when it appears it shouldn't have, please let us know and share the output so we can check on it.

And yes, right now, the ability to check the status of an async job depends on the validity of the original access token used to start that job. If that access token is no longer valid, you won't be able to check the status of an async job, even with another valid access token for that app/user. You'd need to check the result of the job while the original access token is still valid.

View solution in original post

7 Replies 7
Highlighted

Re: Invalid Async Job Id fails if Access Token is Refresshed

Dropboxer

Thanks for the report! 

First, to confirm, yes, the job should run whether or not you actually check the status. If you don't check the status though, you won't know if it failed, and if so, why.

Anyway, regarding the unexpected 'invalid_async_job_id' error, we looked into this and determined this can happen if the original access token used to start the job is revoked or expired. I unfortunately don't have a workaround to share for a way to check the job status in this case, but this is open with the team. I'll follow up here with any updates on this.

Highlighted

Re: Invalid Async Job Id fails if Access Token is Refresshed

Helpful | Level 6

Thanks for the quick response.

Sorry regarding :

"First, to confirm, yes, the job should run whether or not you actually check the status. If you don't check the status though, you won't know if it failed, and if so, why."

So with the below 

Created batch and received a batch job itAt this point I would of expected the job to run and started to create folders
Token Expires here
Check batch job and get invalid_async_job_id
In the above, why would the folders not be created? 

The reason I ask, I was thinking of retrying Create Batch (with a new token) again so my process is not disrupted. I don't want two jobs running and conflicting.

I assume the expired token scenario above would affect all batch jobs? (ie create a job with a good token, the token expires. Check status with another new token(not the original that created the job. Job fails)

Would the following work, if I renew my token earlier on and not let it expire (token looks to be good for 4 hours) would this overcome this problem?

Thanks

Highlighted

Re: Invalid Async Job Id fails if Access Token is Refresshed

Dropboxer

Without more information, I can't say exactly why your folders may not have been created. There are a number of ways for a create_folder_batch job to fail, resulting in the folders not being created. Please refer to the error documentation for the /2/files/create_folder_batch and /2/files/create_folder_batch/check endpoints for information on what errors can occur

Please do try starting the job again with a new access token and check the result within the four hours that the access token is valid. (Or, use a long-lived access token instead.) If API isn't behaving as expected, e.g., if the job fails when it appears it shouldn't have, please let us know and share the output so we can check on it.

And yes, right now, the ability to check the status of an async job depends on the validity of the original access token used to start that job. If that access token is no longer valid, you won't be able to check the status of an async job, even with another valid access token for that app/user. You'd need to check the result of the job while the original access token is still valid.

View solution in original post

Highlighted

Re: Invalid Async Job Id fails if Access Token is Refresshed

Helpful | Level 6

Thanks Greg, is the long-lived access the token you can generate in the admin console?

 

Highlighted

Re: Invalid Async Job Id fails if Access Token is Refresshed

Dropboxer

Yes, that's correct. (You can also still retrieve them using the public OAuth 2 flow.)

Highlighted

Re: Invalid Async Job Id fails if Access Token is Refresshed

Helpful | Level 6

Thanks Greg, all set.

Highlighted

Re: Invalid Async Job Id fails if Access Token is Refresshed

Dropboxer

We've fixed this so that you can now check the async job status even if the original access token is revoked or expired, as long as the access token you are using is for the same app/user pair as the original.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?