Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Omri1984
4 years agoExplorer | Level 4
Dropbox.Api.AuthException: expired_access_token/
Hi my company is using the sdk of dropbox.
an up until now alll was good suddenlty the automatically refresh token stop working and we are getting this error
Dropbox.Api.AuthException: expired_access_token/
at Dropbox.Api.DropboxRequestHandler.<RequestJsonString>d__2f.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Dropbox.Api.DropboxRequestHandler.<RequestJsonStringWithRetry>d__1a.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Dropbox.Api.DropboxRequestHandler.<Dropbox.Api.Stone.ITransport.SendRpcRequestAsync>d__5`3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
is something Changed, we are using an offline token for years and this happened during the process.
Please Help 🙂
8 Replies
- Greg-DB4 years ago
Dropbox Community Moderator
I'll be happy to help with any issues you're having with the Dropbox API, but I'll need some more information. Please reply with:
- the name and version number of the platform and SDK you are using
- the steps to reproduce the issue, including relevant code snippet(s), but don't include any access or refresh token value(s) themselves
- Здравко4 years agoLegendary | Level 20
Omri1984 wrote:...
an up until now alll was good suddenlty the automatically refresh token stop working and we are getting this error
Dropbox.Api.AuthException: expired_access_token/
...
Are you sure you are using refresh token at all? 🤔 The error states access token issues, not refresh token!
- Omri19844 years agoExplorer | Level 4
we are using dropbox 4.7 .net sdk
- Здравко4 years agoLegendary | Level 20
Omri1984 wrote:we are using dropbox 4.7 .net sdk
Version 4.7 does not support refresh tokens! Update it (your application too).
- Greg-DB4 years ago
Dropbox Community Moderator
Omri1984 If you are using v4.7 of the Dropbox .NET SDK, then as Здравко noted, that won't work because that version of the Dropbox .NET SDK didn't support refresh tokens.
It sounds like by "4.7" you may be referring to the version of the .NET framework itself though, not the Dropbox .NET SDK.
Either way, if you still need help with this, please share the rest of the information I requested so we can take a look.
- Omri19844 years agoExplorer | Level 4
this is the one we are using
Dropbox.Api.4.7.0
and we are not doing refresh token at all , all manage automatically
can we have a quick session please
- Здравко4 years agoLegendary | Level 20
Omri1984 wrote:...
and we are not doing refresh token at all , ...
Hi Omri1984,
You are "not doing refresh token at all" - exactly; and that's where you issue is coming from. 🤷 I have no idea why you refuse to understand that.
Omri1984 wrote:..., all manage automatically
...
No, here you are wrong! Version 4.7 doesn't manage that automatically because, at time it had been "on go", had been no need of such management. In meantime many things get changed. Now access token is valid for at most 4 hours (seems, you miss this), not valid forever (as before - 4.7 time)! To prolong the validity, refresh token gets need (something 4.7 doesn't support). That's why you have to update your SDK to recent one and adapt your application use refresh token on client initialization (not access token only). Everything else (most of your application) is back compatible and can stay the same. 😉
Hope this helps.
- Greg-DB4 years ago
Dropbox Community Moderator
Omri1984 I can't offer API support via phone or a virtual meeting, but I can help here.
Здравко is correct, v4.7.0 of the Dropbox .NET SDK does not support refresh tokens. That was added in v5.0.0. You'll need to update to at least that version (or ideally the latest version, currently v6.30.0) for automatic refresh token support.
For reference, Dropbox is in the process of switching to only issuing short-lived access tokens (and optional refresh tokens) instead of long-lived access tokens. You can find more information on this migration here. Attempting to use an expired short-lived access token will result in this 'expired_access_token' error. The latest versions of the official SDKs can handle this for you automatically though, if you use "offline" access/refresh tokens.
Apps can get long-term access by requesting "offline" access, in which case the app receives a "refresh token" that can be used to retrieve new short-lived access tokens as needed, without further manual user intervention. You can find more information in the OAuth Guide and authorization documentation.For the official Dropbox API v2 .NET SDK in C#, you can find an example of getting and using a refresh token in the OauthBasic example (non-PKCE, meant for server-side apps) as well as in the OAuthPKCE example (PKCE, meant for client-side apps). When you supply the
DropboxClientwith the necessary credentials, including the refresh token, as shown in those examples, the client will automatically perform the access token refresh for you.
For reference, while the creation of new long-lived access tokens is now deprecated, we don't currently have a plan to disable existing long-lived access tokens. (If that changes, we will of course announce that ahead of time.) That being the case, you can continue using existing long-lived access token(s) without interruption, if you have any. Also, note though that you won't be able to create new long-lived access tokens.
About Discuss Dropbox Developer & API
Make connections with other developers
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!