We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.
Forum Discussion
donaldp
3 years agoCollaborator | Level 9
expired token when set to not expire
Have read a few posts on related topics here, and something definitely not working correctly...
My app was doing weird things today, and I saw a expired token exception getting thrown. This has...
donaldp
Collaborator | Level 9
I'm having issues with trying to catch this exception. As suggested in another post, I'm using GetCurrentAccountAsync to test if the token is valid - I've put that into a try/catch, and the catch doesn't run! THEN in later calls I start getting the expired token exceptions. i.e. GetCurrentAccountAsync doesn't seem to care that the token is expired (or at least it's not throwing an exception for it). I'm not sure which call is actually triggering the exception (I'm trying to catch it at authorisation so that it doesn't go any further).
CODE
DxClient??=new DropboxClient(DxToken);
try {
System.Diagnostics.Debug.WriteLine("********************************** Checking that token works");
DxClient.Users.GetCurrentAccountAsync();
}
catch (Exception ex) {
System.Diagnostics.Debug.WriteLine($"********************************** Exception in changing Authorised: {ex.Message}");
return;
}
System.Diagnostics.Debug.WriteLine("********************************** Token works!");
OUTPUT
********************************** DxToken is sl......
********************************** Checking that token works
********************************** Token works!
.....
Exception thrown: 'Dropbox.Api.AuthException' in Dropbox.Api.dll
********************************** UNHANDLED EXCEPTION! Details: Dropbox.Api.AuthException: expired_access_token/
donaldp
3 years agoCollaborator | Level 9
I also tried
var result=DxClient.Users.GetCurrentAccountAsync()
in the try/catch - still no exception.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,875 PostsLatest Activity: 2 years 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!