Dropbox refresh token problem

I have a problem authorising in Dropbox. I have made an authorisation using my Dropbox account and this is saved in drafts credentials.
After a while (after a day, or sometimes after several hours) all Dropbox related actions stop working with the message “Dropbox Error: 400 invalid_request “refresh_token”: must not be empty”.
To fix that I have to “forget” Dropbox authorisation and reauthorise.
If I look in the dropbox website it shows that drafts are authorised.
What can I do to avoid this steps - forgetting Dropbox authorisation and reauthorising every day?

Have you tried removing authorisation at the Dropbox end and reauthorising?

If that does not work, maybe create an action so you can check the content of the token? If the token is changing, then you probably have a sync issue (some device overwriting another perhaps?) If the token is not changing, then that suggests that the issue is on the Dropbox side and it’s verification.

Yes, I can remove authorization and it works for some time then.
And I use it on the same device all the time.
I’ll try creating an action to check the token.

You have not explicitly noted doing this in Dropbox, so just to be clear. Originally you said you were clearing the credentials in Drafts, not Dropbox. But you are confirming now that you have cleared and readded the credentials in both Dropbox and Drafts, as two separate places and it continues to fail the authorisation after a while.

Is this a personal Dropbox account? I’m just wondering if it’s possible it’s some enterprise security settings specific to the account.

I know Dropbox used to issue non-expiring tokens via OAuth, and they changed that at some point, but I haven’t had any other reports of issues, so I’d be surprised if it’s a more general problem with the integration.

It is personal free account.
I tried doing full cleansing of the tokens and OAuth. I have removed access permission from Dropbox side and I removes saved token from Drafts on IOS. Then I have authenticated Drafts again. Once it has worked fine. It was today at 15:00. Just now I have tried again. It doesn’t work, exactly same way as before. It’s been 6 hours between this cases.

Has the authentication token in Drafts remained unchanged?

My understanding, which could be wrong, is it should be using that to get your session token and redreshing that as necessary. So I am wondering if that is somehow being lost and resulting in a null token- hence the suggested additional action to check what a Drafts believes the current access token to bem

Yes, I’ll get busy with that tomorrow.
It is such a pity that it doesn’t work as expected, disrupts whole workflow.

The same Dropbox account is easily working with another program from iOS, beorg. So, the problem seems to be not on the Dropbox side.

At the same time, a large proportion of Drafts users (hundreds, thousands?) are using Dropbox integration without such issues. Either there’s about to be lots of Drafts users getting the same issues, or there’s something very specific going on here.

Probably goes without saying, but I assume you are using the latest public release version of Drafts - v31.1.1, right?

Yes, I use the latest versions.
Where can I find how can I get the token stored in Drafts from within the Drafts script?

Arrgh. Ignore that.

It looks like under credentials there are two types - services and credentials. I am able to use the Credential class to access a credentials credential but I haven’t been able to access the Dropbox services credential using this method (I just get asked to authorise for a new credentials credential each time). :confounded:

2022-03-27-23.28.58

I was able to reproduce this issue. It appears Dropbox did make a change to the way it issues OAuth tokens that will require an update to Drafts. Not everyone is seeing it, because existing tokens from before the change kept working.

I will investigate further tomorrow and try to get a fix out ASAP.

2 Likes

I have a fix for this in the beta if anyone wants to test it to confirm the fix.

I have installed beta with TestFlight on iOS, and can confirm that fix works for me.

2 Likes

Thanks for confirming. Will get out an update including this fix soon.