You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
giovaniluigi
5 years agoExplorer | Level 3
Exchange (manually) the authorization code for a re-usable access token fails sometimes
I have integrated the Dropbox API into my .NET software.
In order for the user to link his account with the dropbox folder used by my software, my software gives the user a URL that he enters ...
Greg-DB
Dropbox Staff
We'll be happy to help with this, but we'll need some more information about where and how this is failing. For example, is it failing on the call to /oauth2/token, and what error response are you getting? Thanks in advance!
giovaniluigi
5 years agoExplorer | Level 3
Ok so the only information I have is that when it fails, I get this message from your API:
Type = Dropbox.Api.OAuth2Exception
Message = invalid_grant
Source = Microsoft.Threading.Tasks
ErrorDescription = code has expired (within the last hour)
What I noticed was that the client had a wrong time in its clock.
After synchronizing with the internet time, it worked.
So I am assuming that your API uses the client time for the authentication, which if its true, its a very odd decision.
Could you clarify whether this is the case, or it was just a coincidence that it worked?
- Greg-DB5 years agoDropbox Staff
I don't believe the Dropbox API OAuth 2 authorization code exchange uses the client's time. In fact, the client isn't supposed to send its client time in the /oauth2/token HTTP request anyway.
The authorization code itself does expire though, after a few minutes (based on the Dropbox server time when the code was issued versus when it is sent back for exchange). It sounds like you just happened to use it after the expiration the first time.
About Discuss Dropbox Developer & API
Make connections with other developers
797 PostsLatest Activity: 3 months agoIf 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 or Facebook.
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!